1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

All: Finished service to clean up resources

This commit is contained in:
Laurent Cozic
2018-03-15 18:08:46 +00:00
parent 945018b698
commit c1bb51c12b
10 changed files with 205 additions and 28 deletions

View File

@@ -22,6 +22,8 @@ const NoteTag = require('lib/models/NoteTag.js');
const BaseItem = require('lib/models/BaseItem.js');
const MasterKey = require('lib/models/MasterKey.js');
const BaseModel = require('lib/BaseModel.js');
const BaseService = require('lib/services/BaseService.js');
const ResourceService = require('lib/services/ResourceService');
const { JoplinDatabase } = require('lib/joplin-database.js');
const { Database } = require('lib/database.js');
const { NotesScreen } = require('lib/components/screens/notes.js');
@@ -318,6 +320,8 @@ async function initialize(dispatch) {
reg.setLogger(mainLogger);
reg.setShowErrorMessageBoxHandler((message) => { alert(message) });
BaseService.logger_ = mainLogger;
reg.logger().info('====================================');
reg.logger().info('Starting application ' + Setting.value('appId') + ' (' + Setting.value('env') + ')');
@@ -450,6 +454,12 @@ async function initialize(dispatch) {
AlarmService.garbageCollect();
}, 1000 * 60 * 60);
const resourceService = new ResourceService();
resourceService.maintenance();
PoorManIntervals.setInterval(() => {
resourceService.maintenance();
}, 1000 * 60 * 60 * 4);
reg.scheduleSync().then(() => {
// Wait for the first sync before updating the notifications, since synchronisation
// might change the notifications.