apoc.periodic.countdown

Procedure APOC Core

apoc.periodic.countdown('name',statement,repeat-rate-in-seconds) creates a background job that will repeatedly execute the given Cypher statement until it returns 0.

Signature

apoc.periodic.countdown(name :: STRING?, statement :: STRING?, rate :: INTEGER?) :: (name :: STRING?, delay :: INTEGER?, rate :: INTEGER?, done :: BOOLEAN?, cancelled :: BOOLEAN?)

Input parameters

Name Type Default

name

STRING?

null

statement

STRING?

null

rate

INTEGER?

null

Output parameters

Name Type

name

STRING?

delay

INTEGER?

rate

INTEGER?

done

BOOLEAN?

cancelled

BOOLEAN?

Usage Examples

The examples in this section are based on the following sample graph:

CREATE (:Counter {value: 10000});
The following decrements the value once a second until it gets to 0:
CALL apoc.periodic.countdown(
  "decrement",
  "MATCH (counter:Counter)
   SET counter.value = counter.value - 1
   RETURN counter.value as count",
  1);