Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Django 4 compatibility #2

Merged
merged 8 commits into from
May 17, 2024

Conversation

horthbynorthwest
Copy link

@horthbynorthwest horthbynorthwest commented May 8, 2024

Unlike last time we did this #1 there haven't been many changes made on the base django-cron branch, so there's been nothing to merge in. I've updated the versions and the test matrix to cover django 4 testing, which are all passing.

fired at the same time - which may happened when job execution is longer that job interval.
"""

@transaction.atomic
def lock(self):
lock, created = CronJobLock.objects.get_or_create(job_name=self.job_name)
lock, created = CronJobLock.objects.select_for_update().get_or_create(job_name=self.job_name)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably isn't needed for us, but good future proofing, resolves an issue listed here

@@ -1,6 +1,6 @@
from django.conf import settings

from django_common.helper import send_mail
from django.core.mail import send_mail
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes this issue

@@ -13,7 +13,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9, 3.10, 3.11]
python-version: [3.8, 3.9, '3.10', 3.11]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required due to actions/runner#1989

.travis.yml Outdated
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this file is unused as it uses github/workflows for the test runners.

@horthbynorthwest horthbynorthwest changed the title Feature/django 4 compatibility 187356151 Add Django 4 compatibility May 13, 2024
@horthbynorthwest horthbynorthwest marked this pull request as ready for review May 13, 2024 09:15
@@ -5,13 +5,13 @@

class DatabaseLock(DjangoCronJobLock):
"""
Locking cron jobs with database. Its good when you have not parallel run and want to make sure 2 jobs won't be
Locking cron jobs with database. It's good when you have not parallel run and want to make sure 2 jobs won't be
Copy link

@rob-s-s rob-s-s May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"have not parallel run" doesn't read right? I'm not sure exactly what it means.

Suggested change
Locking cron jobs with database. It's good when you have not parallel run and want to make sure 2 jobs won't be
Locking cron jobs with database. It's good when you have not run cron jobs in parallel and want to make sure 2 jobs won't be

@horthbynorthwest horthbynorthwest merged commit f533cea into master May 17, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants