Skip to content

Commit

Permalink
[Java] Use subtract and compare to zero for all deadline calculations…
Browse files Browse the repository at this point in the history
… for consistency.
  • Loading branch information
mikeb01 committed Nov 11, 2024
1 parent b3379ae commit e605496
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public int doWork(final long nowMs)
{
int workCount = 0;

if (nowMs > workDeadlineMs)
if (workDeadlineMs - nowMs < 0)
{
workDeadlineMs = nowMs + WORK_INTERVAL_MS;
workCount += transport.poll(this, nowMs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int timeoutOldEntries(final long nowMs, final AtomicCounter cacheEntriesCounter)
{
final CacheEntry entry = listOfEntries.get(i);

if (nowMs > entry.deadlineMs)
if (entry.deadlineMs - nowMs < 0)
{
ArrayListUtil.fastUnorderedRemove(listOfEntries, i, lastIndex--);
cacheEntriesCounter.setOrdered(listOfEntries.size());
Expand Down

0 comments on commit e605496

Please sign in to comment.