diff --git a/fifo/__init__.py b/fifo/__init__.py index 34cfd7b..2d5e103 100644 --- a/fifo/__init__.py +++ b/fifo/__init__.py @@ -1,5 +1,15 @@ +import sys + from .fifo import FIFO +# Applying fix from: https://github.com/Azure/azure-functions-python-worker/issues/640 +# [Fix] Create a wrapper for importing imgres +from .date_trigger import * +from . import CustomDateTrigger + +# [Fix] Register imgres into system modules +sys.modules["CustomDateTrigger"] = CustomDateTrigger + async def setup(bot): cog = FIFO(bot) diff --git a/fifo/date_trigger.py b/fifo/date_trigger.py index eb3d617..b024750 100644 --- a/fifo/date_trigger.py +++ b/fifo/date_trigger.py @@ -4,4 +4,7 @@ from apscheduler.triggers.date import DateTrigger class CustomDateTrigger(DateTrigger): def get_next_fire_time(self, previous_fire_time, now): next_run = super().get_next_fire_time(previous_fire_time, now) - return next_run if next_run >= now else None + return next_run if next_run is not None and next_run >= now else None + + def __getstate__(self): + return {"version": 1, "run_date": self.run_date}