Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Correctly update last fetch time
Browse files Browse the repository at this point in the history
If the next event is replaced, use the new timestamp
  • Loading branch information
p1gp1g committed Nov 1, 2023
1 parent f9975cc commit 750b22e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,9 @@ object FcmFetchManager {
if (highPriority) {
this.highPriority = true
}
val now = System.nanoTime()
val performedReplace = EXECUTOR.enqueue { fetch(context, now) }
if (performedReplace) {
Log.i(TAG, "Already have one running and one enqueued. Ignoring.")
} else {
last = now
Log.i(TAG, "Updating last event to $last")
}
last = System.nanoTime()
Log.i(TAG, "Updating last event to $last")
EXECUTOR.enqueue { fetch(context, last) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ public boolean readMessageBatch(long timeout, int batchSize, MessageReceivedCall
callback.onMessageBatch(responses);
}

if (!hitEndOfQueue && responses.size() < batchSize) {
Log.w(TAG, "Did not hit end of queue but responses.size < batchSize (" + responses.size() + " < " + batchSize + ")");
}

return !hitEndOfQueue;
}

Expand Down

0 comments on commit 750b22e

Please sign in to comment.