cryptpad/scripts/expire-channels.js

44 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2018-02-07 09:27:16 +00:00
var nThen = require("nthen");
2020-02-14 21:29:30 +00:00
var Tasks = require("../lib/storage/tasks");
var Logger = require("../lib/log");
2018-02-07 09:27:16 +00:00
var config = require("../lib/load-config");
2020-02-14 21:29:30 +00:00
var FileStorage = require('../lib/storage/file');
2018-02-07 09:27:16 +00:00
nThen(function (w) {
Logger.create(config, w(function (_log) {
config.log = _log;
}));
}).nThen(function (w) {
FileStorage.create(config, w(function (err, _store) {
config.store = _store;
2018-02-07 09:27:16 +00:00
// config.taskPath
// config.store
// config.filePath
// config.blobPath
// config.coldPath
2018-02-07 09:27:16 +00:00
// config.enableTaskScheduling
2018-02-07 09:27:16 +00:00
}));
}).nThen(function (w) {
Tasks.create(config, w(function (err, _tasks) {
if (err) {
throw err;
}
config.tasks = _tasks;
2018-02-07 09:27:16 +00:00
}));
}).nThen(function (w) {
config.tasks.runAll(w(function (err) {
if (err) {
// either TASK_CONCURRENCY
// or an error from tasks.list
}
2018-02-13 17:20:13 +00:00
}));
2018-02-07 09:27:16 +00:00
}).nThen(function () {
config.store.shutdown();
config.log.shutdown();
2018-02-07 09:27:16 +00:00
});