Skip to content

Commit

Permalink
DatabaseScheduler ignores 'expires' option
Browse files Browse the repository at this point in the history
  • Loading branch information
spoksss authored Dec 7, 2018
1 parent 0a1e83d commit 567a7b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions djcelery/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ def from_entry(cls, name, skip_fields=('relative', 'options'), **entry):
obj, _ = PeriodicTask._default_manager.update_or_create(
name=name, defaults=fields,
)
expires = options.get('expires')
if expires and not obj.expires:
# if expires is not properly recognized from options
# delete django DateTimeField from the model instance
# and use just simple int as attribute for this call
del obj.expires
obj.expires = expires
return cls(obj)

def __repr__(self):
Expand Down

0 comments on commit 567a7b7

Please sign in to comment.