Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default () => {
cron.schedule("0 1 * * *", () => {
// require("../workers/receive");
});
};
function registerTask(task){
cron.schedule(task.cron, () => {
process.send({
type: 'execution-request',
data: task
});
});
console.info(`[SCHEDULER DAEMON ${process.pid}]: Task ${task.name} registred`);
process.send({
type: 'registred',
data: task
});
}
exports.init = async function() {
var result = await global.db.collection("gp_cron").find();
cron.schedule('* * * * *', () => {
console.log("Hi, I'm GLAMpipe cron " + new Date());
});
}
var async = require("async");
var cron = require('node-cron');
var nanorpc = require('../nano/rpc_client');
var moment = require('moment');
var Account = require('../models/account');
cron.schedule('5 * * * *', updateScore);
function updateScore() {
console.log('SCORES: Started');
Account.find()
.where('votingweight').gte(1000000000000000000000000000000)
.exec(function (err, accounts) {
if (err) {
console.error('SCORES:', err);
return
}
console.log('SCORES: ' + accounts.length + " accounts");
async.forEachOfSeries(accounts, (account, key, callback) => {
updateScoreAccount(account, callback)
const serverRouter = require('./routes/server');
const indexRouter = require('./routes/index');
const app = express();
app.use(logger('dev'));
app.use(express.json());
app.use(cors());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, './views')));
global.assistants = {};
cron.schedule("0 1 * * *", function() {
if(isUpdateAvailable) console.log(`An update is available. Please visit https://github.com/greghesp/assistant-relay/releases`);
});
(async function () {
try {
await initializeServer();
} catch (e) {
console.error(e)
}
})();
app.use('/server', serverRouter);
app.use('/', indexRouter);
app.use(function(req, res, next) {
next(createError(404));
return Observable.create((observer) => {
observer.next({ type: 'start' });
const task = cron.schedule(cronSchedule, () =>
observer.next({ type: 'backup' }),
);
task.start();
return {
unsubscribe: () => {
task.destroy();
},
};
}).pipe(
switchMap(({ type }) => {
modem.connect(function(){
cron.schedule('*/5 * * * *', function(){
speedTest({maxTime: 5000}).on('data', data => {
var info = {
"download": data.speeds.download,
"upload": data.speeds.upload,
"publicIP": data.client.ip
}
modem.info = info;
modem.logger.info('internet info', info);
}).on('error', err => {
modem.logger.error(err);
});
const achievementsTemporaryInactivities = async () => {
cron.schedule('0 0 0 * * *', async () => {
try {
logs.info('[*] Starting cron: achievementsTemporaryInactivities')
const inactives = await achievementsTemporary.findInactivities()
inactives.map(achievement => {
const updatedAchievement = achievementsTemporary.resetEarned(
achievement
)
updatedAchievement.save()
})
logs.info('[*] Ending cron: achievementsTemporaryInactivities')
} catch (e) {
errors._throw(file, 'achievementsTemporaryInactivities', e)
}
})
}
export default async () => {
cron.schedule(
"1 0 * * *",
async () => {
await rankingController.save();
},
null,
true,
"America/Sao_Paulo"
);
cron.schedule(
"* 9 * * mon",
async () => {
await rankingController.sendToChannel();
},
null,
true,
"America/Sao_Paulo"
);
cron.schedule(
"55 23 30 4,6,9,11 *",
async () => {
await rankingController.sendToChannel();
},
null,
true,