chrisspen/django-chroniker

Logs are being deleted when restarting django-chroniker

tehhuimin opened this issue · 0 comments

Issue Description:
Hi, we face this issue on our environment when we restart the django-chroniker service, it will delete whole bunch of previous logs in all jobs, even we have set the Maximum log entries for that specific job to be 1000 at that job has lesser than 1000 logs at that moment.

Expected Behavior:
Expected behavior is that logs are being persisted for each job until reach the Maximum log entries is reached.

Actual Behavior:
Some logs from other jobs are deleted when they haven't exceeded the threshold set.

Steps to Reproduce:

  1. Create a job and set a Maximum log entries=1000 for the job.
  2. Create another job B and set maxim log entries = 1000 for the job.
  3. Run a job at 1 minute interval until we have more than 1000 logs for job A.
  4. Run the job a few times for job B (have log entries less than 1000).
  5. Restart django-chroniker.
  6. Note that some of the logs in job B will also be deleted.

Possible Solution:
I have made a PR at #328.
This will ensure the logs are only deleted for the Jobs that has exceeded threshold.

Environment:
Ubuntu 20.04.6
django-chroniker version: django-chroniker==1.0.22