Skip to content

Commit 4f419f1

Browse files
committed
Revert "fix: track time spent in recursive markOrRun calls"
This reverts commit 7174692.
1 parent 7174692 commit 4f419f1

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

apps/files_sharing/lib/Listener/SharesUpdatedListener.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ class SharesUpdatedListener implements IEventListener {
4343
private float $cutOffMarkTime;
4444

4545
/**
46-
* Timestamp marking the first time this listener was triggered, used to
47-
* determine if we should update the share date immediately or just mark the
48-
* users for refresh.
46+
* The total amount of time we've spent so far processing updates
4947
*/
50-
private ?float $firstRun = null;
48+
private float $updatedTime = 0.0;
5149

5250
public function __construct(
5351
private readonly IManager $shareManager,
@@ -130,15 +128,14 @@ public function handle(Event $event): void {
130128
}
131129

132130
private function markOrRun(IUser $user, callable $callback): void {
133-
$now = (float)$this->clock->now()->format('U.u');
134-
$this->firstRun ??= $now;
135-
$elapsed = $now - $this->firstRun;
136-
137-
if ($this->cutOffMarkTime === -1.0 || $elapsed < $this->cutOffMarkTime) {
131+
$start = floatval($this->clock->now()->format('U.u'));
132+
if ($this->cutOffMarkTime === -1.0 || $this->updatedTime < $this->cutOffMarkTime) {
138133
$callback();
139134
} else {
140135
$this->markUserForRefresh($user);
141136
}
137+
$end = floatval($this->clock->now()->format('U.u'));
138+
$this->updatedTime += $end - $start;
142139
}
143140

144141
private function updateOrMarkUser(IUser $user): void {

0 commit comments

Comments
 (0)