Skip to content

Commit

Permalink
feat: AdaptiveBuilder完善
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Jun 11, 2024
1 parent ba53498 commit 29f83a4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Builders/Traits/AdaptiveTimerMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ trait AdaptiveTimerMethod
/** @var float|null 定时器最初间隔 */
private float|null $timerInitialInterval = null;

/** @var int|null 最后一次获取消息的毫秒时间戳 */
private static ?int $lastMessageMilliTimestamp = null;
/** @var int 最后一次获取消息的毫秒时间戳 */
private static int $lastMessageMilliTimestamp = 0;

/** @var bool 是否到达最大间隔 */
private static bool $isMaxTimerInterval = false;
Expand Down Expand Up @@ -132,8 +132,6 @@ public function adaptiveTimerCreate(Closure $func, mixed ...$args): string
if (!Worker::$globalEvent) {
throw new WebmanRqueueException("Event driver error. ", -1);
}
// 初始化上一次获取信息的毫秒时间戳
self::$lastMessageMilliTimestamp = self::$lastMessageMilliTimestamp ?? intval(microtime(true) * 1000);
// 增加定时器
$id = spl_object_hash($func);
self::$timerIdMap[$id] = Worker::$globalEvent->add(
Expand Down

0 comments on commit 29f83a4

Please sign in to comment.