CheeseAPI 2.0.5b3__tar.gz → 2.0.5b4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/scheduler.py +14 -8
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/PKG-INFO +1 -1
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/pyproject.toml +1 -1
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/.gitignore +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/__init__.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/app.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/cors.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/file.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/printer.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/request.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/response.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/route.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/signal.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/static.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/validator.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/CheeseAPI/websocket.py +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/LICENSE +0 -0
- {cheeseapi-2.0.5b3 → cheeseapi-2.0.5b4}/README.md +0 -0
|
@@ -94,7 +94,7 @@ class Task:
|
|
|
94
94
|
|
|
95
95
|
async def async_start(self):
|
|
96
96
|
if not self._handler:
|
|
97
|
-
self._handler = asyncio.create_task(self._scheduler_proxy.async_task_processing(self.key, self.fn, *self.args, **self.kwargs))
|
|
97
|
+
self._handler = asyncio.create_task(self._scheduler_proxy.async_task_processing(self.key, self._queue, self.fn, *self.args, **self.kwargs))
|
|
98
98
|
|
|
99
99
|
@property
|
|
100
100
|
def key(self) -> str:
|
|
@@ -436,13 +436,16 @@ class SchedulerProxy:
|
|
|
436
436
|
return
|
|
437
437
|
|
|
438
438
|
queue.get()
|
|
439
|
+
task._queue.get()
|
|
440
|
+
first_run = True
|
|
441
|
+
|
|
439
442
|
if task.first_run_timer:
|
|
440
443
|
await asyncio.sleep(max(0, task.first_run_timer.timestamp() - time.time()))
|
|
441
444
|
|
|
442
445
|
while not queue.qsize():
|
|
443
446
|
if static.scheduler_sync_servers:
|
|
444
447
|
task = await self.async_get_task(key)
|
|
445
|
-
if (not task or task._queue.qsize()):
|
|
448
|
+
if (not task or (not first_run and task._queue.qsize())):
|
|
446
449
|
break
|
|
447
450
|
|
|
448
451
|
now = time.time()
|
|
@@ -456,21 +459,24 @@ class SchedulerProxy:
|
|
|
456
459
|
task = await self.async_get_task(key)
|
|
457
460
|
|
|
458
461
|
if task:
|
|
462
|
+
if first_run:
|
|
463
|
+
task._queue.get()
|
|
459
464
|
task._last_run_time = time.time() - now
|
|
460
465
|
task._last_run_timer = datetime.datetime.fromtimestamp(now)
|
|
461
466
|
task._run_num += 1
|
|
462
467
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
468
|
+
if static.scheduler_sync_servers:
|
|
469
|
+
sync_server = redis.asyncio.Redis(connection_pool = static.scheduler_sync_servers[1])
|
|
470
|
+
await sync_server.hset('CheeseAPI_scheduler_tasks', key, json.dumps(task._to_dict()))
|
|
471
|
+
await sync_server.hpexpire('CheeseAPI_scheduler_tasks', int(task.timeout * 1000), key)
|
|
467
472
|
|
|
468
|
-
if
|
|
473
|
+
if (not task or task._queue.qsize()) or task.run_num_completed:
|
|
469
474
|
break
|
|
470
475
|
|
|
476
|
+
first_run = False
|
|
471
477
|
await asyncio.sleep(max(0, task.interval_time - time.time() + now))
|
|
472
478
|
|
|
473
|
-
if task.auto_remove:
|
|
479
|
+
if not task or task.auto_remove:
|
|
474
480
|
self._tasks.pop(task.key, None)
|
|
475
481
|
if static.scheduler_sync_servers is not None:
|
|
476
482
|
await redis.asyncio.Redis(connection_pool = static.scheduler_sync_servers[1]).hdel('CheeseAPI_scheduler_tasks', key)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|