fix worker not finding unprocessed segments
parent
f9b98cc120
commit
ca94b1c1a0
|
@ -1,2 +1,2 @@
|
|||
DB_HOST=db
|
||||
STORAGE_PATH=/realdata
|
||||
STORAGE_PATH=/realdata/
|
||||
|
|
|
@ -69,7 +69,11 @@ router.get('/v1.1/devices/:dongleId/', runAsyncWrapper(async (req, res) => {
|
|||
const device = await deviceController.getDeviceFromDongleId(dongleId);
|
||||
if (!device) {
|
||||
logger.info(`HTTP.DEVICES device ${dongleId} not found`);
|
||||
return res.status(404).json({ is_paired: false, prime: false });
|
||||
return res.status(200).json({
|
||||
is_paired: false,
|
||||
prime: false,
|
||||
prime_type: 0,
|
||||
});
|
||||
}
|
||||
|
||||
const {
|
||||
|
|
|
@ -4,7 +4,12 @@ import log4js from 'log4js';
|
|||
|
||||
import app from './app';
|
||||
import storageController from './controllers/storage';
|
||||
import orm, { Accounts, Devices, Drives } from '../models';
|
||||
import orm, {
|
||||
Accounts,
|
||||
Devices,
|
||||
Drives,
|
||||
DriveSegments,
|
||||
} from '../models';
|
||||
|
||||
export default async () => {
|
||||
const logger = log4js.getLogger();
|
||||
|
@ -25,12 +30,22 @@ export default async () => {
|
|||
logger.info('Database synced', options);
|
||||
|
||||
// debug: print out some info from the database
|
||||
Promise.all([Accounts.findAll(), Devices.findAll(), Drives.findAll()])
|
||||
.then(([accounts, devices, drives]) => {
|
||||
logger.info(`Found ${accounts.length} accounts`);
|
||||
logger.info(`Found ${devices.length} devices`);
|
||||
logger.info(`Found ${drives.length} drives`);
|
||||
});
|
||||
await Promise.all([
|
||||
Accounts.findAll(),
|
||||
Devices.findAll(),
|
||||
Drives.findAll(),
|
||||
DriveSegments.findAll(),
|
||||
]).then(([
|
||||
accounts,
|
||||
devices,
|
||||
drives,
|
||||
driveSegments,
|
||||
]) => {
|
||||
logger.info(`Found ${accounts.length} accounts`);
|
||||
logger.info(`Found ${devices.length} devices`);
|
||||
logger.info(`Found ${drives.length} drives`);
|
||||
logger.info(`Found ${driveSegments.length} drive segments`);
|
||||
});
|
||||
|
||||
const httpServer = http.createServer(await app());
|
||||
httpServer.listen(process.env.HTTP_PORT, () => {
|
||||
|
|
|
@ -252,9 +252,10 @@ async function updateSegments() {
|
|||
where: {
|
||||
upload_complete: false,
|
||||
is_stalled: false,
|
||||
process_attempts: {
|
||||
[Op.lt]: 5,
|
||||
},
|
||||
[Op.or]: [
|
||||
{ process_attempts: { [Op.lt]: 5 } },
|
||||
{ process_attempts: null },
|
||||
],
|
||||
},
|
||||
order: [['created', 'ASC']],
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue