CheeseAPI 2.0.6b2__tar.gz → 2.0.6b3__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.
@@ -242,6 +242,7 @@ class SchedulerProxy:
242
242
 
243
243
  def __setstate__(self, state):
244
244
  self.app = state[1]['app']
245
+ self._tasks = {}
245
246
 
246
247
  def init(self, app = None):
247
248
  if not app:
@@ -357,7 +358,6 @@ class SchedulerProxy:
357
358
  return
358
359
 
359
360
  queue.get()
360
- task._queue.get()
361
361
  first_run = True
362
362
 
363
363
  if task.first_run_timer:
@@ -383,8 +383,6 @@ class SchedulerProxy:
383
383
  task = self.get_task(key)
384
384
 
385
385
  if task:
386
- if first_run:
387
- task._queue.get()
388
386
  task._last_run_time = time.time() - now
389
387
  task._last_run_timer = datetime.datetime.fromtimestamp(now)
390
388
  task._run_num += 1
@@ -402,8 +400,6 @@ class SchedulerProxy:
402
400
  except (KeyboardInterrupt, SystemExit):
403
401
  ...
404
402
 
405
- queue.put(None)
406
-
407
403
  if static.scheduler_sync_servers and task:
408
404
  redis.Redis(connection_pool = static.scheduler_sync_servers[0]).hpersist('CheeseAPI_scheduler_tasks', key)
409
405
 
@@ -413,7 +409,6 @@ class SchedulerProxy:
413
409
  return
414
410
 
415
411
  queue.get()
416
- task._queue.get()
417
412
  first_run = True
418
413
 
419
414
  if task.first_run_timer:
@@ -439,8 +434,6 @@ class SchedulerProxy:
439
434
  task = await self.async_get_task(key)
440
435
 
441
436
  if task:
442
- if first_run:
443
- task._queue.get()
444
437
  task._last_run_time = time.time() - now
445
438
  task._last_run_timer = datetime.datetime.fromtimestamp(now)
446
439
  task._run_num += 1
@@ -470,7 +463,8 @@ class SchedulerProxy:
470
463
  elif task.run_type == 'PROCESS' and isinstance(task._handler, multiprocessing.Process):
471
464
  task._handler.join()
472
465
  self._tasks.pop(task.key, None)
473
- redis.Redis(connection_pool = static.scheduler_sync_servers[0]).hdel('CheeseAPI_scheduler_tasks', task.key)
466
+ if static.scheduler_sync_servers:
467
+ redis.Redis(connection_pool = static.scheduler_sync_servers[0]).hdel('CheeseAPI_scheduler_tasks', task.key)
474
468
 
475
469
  def start(self, key: str):
476
470
  task = self.get_task(key)
@@ -504,7 +498,7 @@ class SchedulerProxy:
504
498
  if not task and static.scheduler_sync_servers:
505
499
  await redis.asyncio.Redis(connection_pool = static.scheduler_sync_servers[1]).publish('CheeseAPI_scheduler', json.dumps(['start', key]))
506
500
  else:
507
- task._handler = asyncio.create_task(self.async_task_processing(task, *task.args, **task.kwargs))
501
+ task._handler = asyncio.create_task(self.async_task_processing(key, task._queue, task.fn, *task.args, **task.kwargs))
508
502
 
509
503
  def stop(self, key: str):
510
504
  task = self.get_task(key)
@@ -524,7 +518,7 @@ class SchedulerProxy:
524
518
 
525
519
  def remove(self, key: str):
526
520
  task = self.get_task(key)
527
- if not task or not task.is_running:
521
+ if not task:
528
522
  return
529
523
 
530
524
  _task = self._tasks.get(key)
@@ -554,7 +548,7 @@ class SchedulerProxy:
554
548
 
555
549
  async def async_remove(self, key: str):
556
550
  task = await self.async_get_task(key)
557
- if not task or not task.is_running:
551
+ if not task:
558
552
  return
559
553
 
560
554
  _task = self._tasks.get(key)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CheeseAPI
3
- Version: 2.0.6b2
3
+ Version: 2.0.6b3
4
4
  Summary: 一款web协程框架
5
5
  Project-URL: Source, https://github.com/CheeseUnknown/CheeseAPI
6
6
  Author-email: Cheese Unknown <cheese@cheese.ren>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "CheeseAPI"
7
- version = "2.0.6-beta.2"
7
+ version = "2.0.6-beta.3"
8
8
  description = "一款web协程框架"
9
9
  readme = "README.md"
10
10
  license-files = { paths = [ "LICENSE" ] }
File without changes
File without changes
File without changes