Skip to content

Commit

Permalink
Fix time not change
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy committed Aug 31, 2022
1 parent 42c76a5 commit e72329a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions db/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def get(self, id, fields=None, one_or_none=False, first=True, to_dict=True
return self.to_dict(result,fields)
return result

async def list(self, userid=None, fields=None, limit=1000, to_dict=True, scan=False, scan_time=time.time(), sql_session=None, **kwargs):
async def list(self, userid=None, fields=None, limit=1000, to_dict=True, scan=False, scan_time=None, sql_session=None, **kwargs):
if fields is None:
_fields = Task
else:
Expand All @@ -97,7 +97,7 @@ async def list(self, userid=None, fields=None, limit=1000, to_dict=True, scan=Fa
if userid is not None:
smtm = smtm.where(Task.userid == userid)

if scan:
if scan and scan_time is not None:
smtm = smtm.where(Task.next <= scan_time)

for key, value in kwargs.items():
Expand All @@ -114,5 +114,7 @@ async def list(self, userid=None, fields=None, limit=1000, to_dict=True, scan=Fa
def delete(self, id, sql_session=None):
return self._delete(delete(Task).where(Task.id == id), sql_session=sql_session)

async def scan(self, now=time.time(), fields=None, sql_session=None):
async def scan(self, now=None, fields=None, sql_session=None):
if now is None:
now = time.time()
return await self.list(fields=fields, scan=True, scan_time=now, limit=None, sql_session=sql_session)

0 comments on commit e72329a

Please sign in to comment.