apoc.periodic.countdown

Details

Syntax

apoc.periodic.countdown(name, statement, delay) :: (name, delay, rate, done, cancelled)

Description

Runs a repeatedly called background statement until it returns 0.

Input arguments

Name

Type

Description

name

STRING

The name of the job.

statement

STRING

The Cypher statement to run, returning a count on each run indicating the remaining iterations.

delay

INTEGER

The delay in seconds to wait between each job execution.

Return arguments

Name

Type

Description

name

STRING

The name of the job.

delay

INTEGER

The delay on the job.

rate

INTEGER

The rate of the job.

done

BOOLEAN

If the job has completed.

cancelled

BOOLEAN

If the job has been cancelled.

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);