apoc.periodic.countdownProcedure
|
This procedure is not intended to be used in a cluster environment, and may act unpredictably. It continues to execute against the same database that it was initiated on, meaning that in a cluster environment, it only executes on the leader. If there is a leader switch then the procedure may error and stop running. |
Syntax |
|
||
Description |
Runs a repeatedly called background statement until it returns 0. |
||
Input arguments |
Name |
Type |
Description |
|
|
The name of the job. |
|
|
|
The Cypher statement to run, returning a count on each run indicating the remaining iterations. |
|
|
|
The delay in seconds to wait between each job execution. |
|
Return arguments |
Name |
Type |
Description |
|
|
The name of the job. |
|
|
|
The delay on the job. |
|
|
|
The rate of the job. |
|
|
|
If the job has completed. |
|
|
|
If the job has been cancelled. |
|
Usage Examples
The examples in this section are based on the following sample graph:
CREATE (:Counter {value: 10000});
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);