You can use apoc
procedure calls for scheduling background jobs. apoc.periodic.schedule()
makes sense in your case.
CALL apoc.periodic.schedule('offerValidater',
"MATCH (n: Offer) WHERE apoc.date.currentTimestamp() - n.CREATED_ON > 604800000 SET n.IS_VALID = 'No'",
86400)
Here I assumed that offer.CREATED_ON
is in epoch milliseconds. If you are using other format timestamps you need to do a comparison accordingly. offerValidater
routine is scheduled to run with a delay of 86400 seconds (1 day).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…