We have a pretty large binlog (55gb). Today when we restarted the server we found out that jobs were delayed longer then originally specified when inserting the job.
The output of stats-job (shorted) shows the issue (compare age, delay and time-left)
Since the additional delay was never more than about the time beanstalk took to load its binlog i checked the source and found
https://github.com/kr/beanstalkd/blob/master/prot.c#L1857 which looks like the cause of the issue to me.
I think now_usec() should be used there instead of started_at. Was there any reason to use started_at there instead of now_usec() (saving syscalls ?).
You're right, we should be using the current time.
I wasn't trying to avoid syscalls; this is just a bug.
recompute delay with current time; fixes #62