evan
05/13/2019, 4:50 PMnode-cron
job for this which starts scheduling on the yoga server start…
Sample Job
import * as cron from 'node-cron'
import {prisma} from './generated/prisma-client'
let cronCounter: number = 0
const updateData = cron.schedule(
'*/1 * * * *',
() => {
prisma.updateCanvas({
where: {id: '1'},
data: {data: `cron data${cronCounter}`},
})
cronCounter++
console.log('cron job: updateData')
},
{scheduled: false},
)
export {updateData}
The cron job runs, but the database isn’t actually updated. I assume this is because its not attached to a request from the graphQL server. Is there any way to implement this type of system?Harshit
05/13/2019, 4:52 PMevan
05/13/2019, 4:56 PM