Skip to content

Commit 0f0e3d6

Browse files
committed
fix:修复定时任务的部分错误
1 parent 0205ef3 commit 0f0e3d6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/cleanphp/process/Async.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace cleanphp\process;
1515

1616
use cleanphp\App;
17+
use cleanphp\base\Dump;
1718
use cleanphp\base\Error;
1819
use cleanphp\base\EventManager;
1920
use cleanphp\base\Request;
@@ -137,11 +138,17 @@ public static function response()
137138
App::exit("您无权访问该资源。");
138139
return;
139140
}
140-
141+
try {
141142
$key = $asyncObject->key;
142143
$function = $asyncObject->function;
143144
$timeout = $asyncObject->timeout;
145+
} catch (NoticeException $exception) {
146+
Log::record("Async", "序列化对象错误!");
147+
148+
Log::record("Async", "错误对象:".(new Dump())->dumpTypeAsString($asyncObject));
144149

150+
App::exit("序列化对象错误");
151+
}
145152
set_time_limit($timeout);
146153
Variables::set("__async_task_id__", $key);
147154
Variables::set("__frame_log_tag__", "async_{$key}_");

src/library/task/TaskerManager.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ public static function getList()
3030
if (empty($list)) {
3131
return [];
3232
} else {
33+
34+
foreach ($list as $key=>$value){
35+
if(!is_object($value)|| get_class($value)!==TaskInfo::class){
36+
unset($list[$key]);
37+
}
38+
}
39+
3340
return $list;
3441
}
3542
}

0 commit comments

Comments
 (0)