summaryrefslogtreecommitdiff
path: root/lib/workers/noteRevisionSaver.js
blob: b6b117a3157e33e4e658409855030527d7f64790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// core
var logger = require("../logger.js");
var models = require("../models");

process.on('message', function (data) {
    if (!data || !data.msg || data.msg !== 'save note revision') return process.exit();
    models.Revision.saveAllNotesRevision(function (err, notes) {
        if (err) {
            logger.error('note revision saver failed: ' + err);
            return process.exit();
        }
        if (notes && notes.length <= 0) {
            process.send({
                msg: 'empty'
            });
        }
        process.exit();
    });
});