Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
support llong TTL in cron
Browse files Browse the repository at this point in the history
The cron expression was not supportive of durations that crossed a day bounddary
  • Loading branch information
shalomcarmel committed Jun 3, 2020
1 parent 776cce5 commit 35b1d20
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ Resources:
delete_at_time = datetime.now() + timedelta(minutes=int(ttl))
hh = delete_at_time.hour
mm = delete_at_time.minute
cron_exp = "cron({} {} * * ? *)".format(mm, hh)
yyyy = delete_at_time.year
month = delete_at_time.month
dd = delete_at_time.day
# minutes hours day month day-of-week year
cron_exp = "cron({} {} {} {} ? {})".format(mm, hh, dd, month, yyyy)
return cron_exp
def handler(event, context):
Expand Down

0 comments on commit 35b1d20

Please sign in to comment.