Fix to pickle error and Nonetype comparison
This commit is contained in:
parent
837cff7a26
commit
3f997fa804
@ -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)
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user