Skip to content

Commit 48e0b7f

Browse files
diegomtz5claude
andcommitted
Fix time conversion in didReachMaxQueueTime
- Replace kDefaultBufferSize (event count) with kMillisecondsPerSecond - kDefaultBufferSize was semantically incorrect for time conversion - Both equal 1000 so behavior unchanged, but now semantically correct Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent d1d985c commit 48e0b7f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Agent/Analytics/NRMAEventManager.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
static const NSUInteger kDefaultBufferTimeSeconds = 60; // 60 seconds
1919
static const NSUInteger kMinBufferTimeSeconds = 60; // 60 seconds
2020
static const NSUInteger kBufferTimeSecondsLeeway = 60; // 60 seconds
21+
static const double kMillisecondsPerSecond = 1000.0; // milliseconds to seconds conversion
2122

2223
// Event Key Format String: TimeStamp|SessionElapsedTime|EventType
2324
static NSString* const eventKeyFormat = @"%f|%f|%@";
@@ -74,9 +75,9 @@ - (BOOL)didReachMaxQueueTime:(NSTimeInterval)currentTimeMilliseconds {
7475
if(oldestEventTimestamp == 0) {
7576
return false;
7677
}
77-
78+
7879
NSTimeInterval oldestEventAge = currentTimeMilliseconds - oldestEventTimestamp;
79-
return (oldestEventAge / kDefaultBufferSize) + kBufferTimeSecondsLeeway >= maxBufferTimeSeconds;
80+
return (oldestEventAge / kMillisecondsPerSecond) + kBufferTimeSecondsLeeway >= maxBufferTimeSeconds;
8081
}
8182

8283
- (NSUInteger)getEvictionIndex {

0 commit comments

Comments
 (0)