I have the following problem:

1. A leader server creates objects which have a start time and end time. The start time and end time are set when an object gets created.
2. The Start time of the object is set to current time on the leader node, and end time is set to Start time + Delta Time
3. A thread wakes up regularly and checks if the End time for any of the objects are lesser than the current time (hence the object has expired) - if yes then the object needs to be deleted

All this works fine, as long as things are running smoothly on leader node. If the leader node goes down, one of the follower node becomes the new leader. (There will be replication among leader and follower node (RAFT algorithm))

Now on the new leader, the time could be very different from the previous leader. Hence the computation in step 3 could be misleading.

One way to solve this problem, is to keep the clocks of nodes (leader and followers) in sync (as much as possible).

But I am wondering if there is any other way to resolve this problem of "expiry" with distributed nodes?

Further Information:

1. Will be using RAFT protocol for message passing and state
replication
2. It will have known bounds on the delay of message between processes
3. Leader and follower failures will be tolerated (as per RAFT protocol)
4. Message loss is assumed not to occur (RAFT ensures this)
5. The operation on objects is to check if they are alive. Objects will be enqueued by a client.
6. There will be strong consistency among processes (RAFT provides this)