File tree Expand file tree Collapse file tree
apps/files_sharing/lib/Listener Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments