You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Fix database upgrade
This commit is contained in:
@ -4,6 +4,7 @@ const Note = require('lib/models/Note');
|
||||
const Resource = require('lib/models/Resource');
|
||||
const BaseModel = require('lib/BaseModel');
|
||||
const BaseService = require('lib/services/BaseService');
|
||||
const { shim } = require('lib/shim');
|
||||
|
||||
class ResourceService extends BaseService {
|
||||
|
||||
@ -23,7 +24,7 @@ class ResourceService extends BaseService {
|
||||
WHERE item_type = ?
|
||||
AND id > ?
|
||||
ORDER BY id ASC
|
||||
LIMIT 10
|
||||
LIMIT 100
|
||||
`, [BaseModel.TYPE_NOTE, lastId]);
|
||||
|
||||
if (!changes.length) break;
|
||||
@ -77,6 +78,21 @@ class ResourceService extends BaseService {
|
||||
await this.deleteOrphanResources();
|
||||
}
|
||||
|
||||
static runInBackground() {
|
||||
if (this.isRunningInBackground_) return;
|
||||
|
||||
this.isRunningInBackground_ = true;
|
||||
const service = new ResourceService();
|
||||
|
||||
setTimeout(() => {
|
||||
service.maintenance();
|
||||
}, 1000 * 30);
|
||||
|
||||
shim.setInterval(() => {
|
||||
service.maintenance();
|
||||
}, 1000 * 60 * 60 * 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ResourceService;
|
Reference in New Issue
Block a user