idle_seconds()
- Dominant language
- Python
- Stars
- 12.3k
- Forks
- 999
- PR merge metrics
- No merged PRs in 30d
Description
If a job takes a long time to run there will be a lot of drift in the schedule. See the printout for a run every hour job below.
completed at 2019-06-23 06:14:42.699195
completed at 2019-06-23 07:14:55.367440
completed at 2019-06-23 08:15:07.838098
completed at 2019-06-23 09:15:20.971490
completed at 2019-06-23 10:15:33.760457
completed at 2019-06-23 11:15:46.067947
completed at 2019-06-23 12:15:58.302904
completed at 2019-06-23 13:16:10.821268
completed at 2019-06-23 14:16:23.222868
completed at 2019-06-23 15:16:36.027845
completed at 2019-06-23 16:16:48.539771
completed at 2019-06-23 17:17:01.175963
completed at 2019-06-23 18:17:13.331349
completed at 2019-06-23 19:17:25.791144
completed at 2019-06-23 20:17:38.411714
completed at 2019-06-23 21:17:51.048057
completed at 2019-06-23 22:18:03.749842
completed at 2019-06-23 23:18:16.268644
completed at 2019-06-24 00:18:28.792911
completed at 2019-06-24 01:18:41.192826
completed at 2019-06-24 02:18:53.689401
completed at 2019-06-24 03:19:06.411706
completed at 2019-06-24 04:19:18.755680
completed at 2019-06-24 05:19:31.451825
completed at 2019-06-24 06:19:44.065015
completed at 2019-06-24 07:19:56.678797
completed at 2019-06-24 08:20:09.482939
completed at 2019-06-24 09:20:23.157429
completed at 2019-06-24 10:20:36.397350
completed at 2019-06-24 11:20:49.023885
completed at 2019-06-24 12:21:01.268487
completed at 2019-06-24 13:21:13.907559
instead of
```python
@property
def idle_seconds(self):
"""
:return: Number of seconds until
:meth:`next_run `.
"""
return (self.next_run - datetime.datetime.now()).total_seconds()
```
i thinks it should be
```python
@property
def idle_seconds(self):
"""
:return: Number of seconds until
:meth:`next_run `.
"""
return (self.next_run - self.last_run).total_seconds()
```
That way it does not run on drift.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.