Skip to content

Commit 70b24c4

Browse files
committed
fix: off by one error
1 parent 84ce95d commit 70b24c4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Instrumentation/Sessions/SessionManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ public class SessionManager {
4848
if let previousSession {
4949
SessionEventInstrumentation.addSession(session: previousSession, eventType: .end)
5050
}
51-
if previousSession != nil {
52-
SessionEventInstrumentation.addSession(session: currentSession, eventType: .start)
53-
NotificationCenter.default.post(name: SessionEventNotification, object: currentSession)
54-
}
51+
SessionEventInstrumentation.addSession(session: currentSession, eventType: .start)
52+
NotificationCenter.default.post(name: SessionEventNotification, object: currentSession)
5553
}
5654

5755
SessionStore.scheduleSave(session: currentSession)
@@ -65,6 +63,7 @@ public class SessionManager {
6563
}
6664

6765
/// Creates a new session with a unique identifier
66+
/// *Warning* - this must be a pure function since it is used inside a lock
6867
private func startSession() -> Session {
6968
let now = Date()
7069

@@ -78,6 +77,7 @@ public class SessionManager {
7877
}
7978

8079
/// Extends the current session expiry time
80+
/// *Warning* - this must be a pure function since it is used inside a lock
8181
private func refreshSession(session: Session) -> Session {
8282
return Session(
8383
id: session.id,

0 commit comments

Comments
 (0)