Skip to content

Commit

Permalink
⚡️ [RUMF-841] remove session renew support in rum recorder (#713)
Browse files Browse the repository at this point in the history
When the session is renewed, a new View is created. This commit removes
unneeded callbacks invoked when the session is renewed, since they are
already triggered when a view is created.
  • Loading branch information
BenoitZugmeyer authored Feb 3, 2021
1 parent 8a2dc67 commit 89d53e1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
13 changes: 0 additions & 13 deletions packages/rum-recorder/src/boot/recorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,6 @@ describe('startRecording', () => {
})
})

it('takes a full snapshot when the session is renewed', (done) => {
const { lifeCycle } = setupBuilder.build()

lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)

flushSegment(lifeCycle)

waitRequestSendCalls(2, (calls) => {
expect(getRequestData(calls.mostRecent()).has_full_snapshot).toBe('true')
expectNoExtraRequestSendCalls(done)
})
})

it('adds a ViewEnd snapshot when the view ends', (done) => {
const { lifeCycle } = setupBuilder.build()

Expand Down
1 change: 0 additions & 1 deletion packages/rum-recorder/src/boot/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export function startRecording(
emit: addRawRecord,
})!

lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, takeFullSnapshot)
lifeCycle.subscribe(LifeCycleEventType.VIEW_CREATED, takeFullSnapshot)
const { stop: stopTrackingFocusRecords } = trackFocusRecords(lifeCycle, addRawRecord)
trackViewEndRecord(lifeCycle, (record) => addRawRecord(record))
Expand Down
6 changes: 0 additions & 6 deletions packages/rum-recorder/src/domain/segmentCollection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ describe('startSegmentCollection', () => {
expect(sendCurrentSegment().creation_reason).toBe('view_change')
})

it('flushes segment on session renew', () => {
const { lifeCycle, sendCurrentSegment } = startSegmentCollection(CONTEXT)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(sendCurrentSegment().creation_reason).toBe('session_renewed')
})

it('flushes segment when the page become hidden', () => {
setPageVisibility('hidden')
const { eventEmitter, sendCurrentSegment } = startSegmentCollection(CONTEXT)
Expand Down
5 changes: 0 additions & 5 deletions packages/rum-recorder/src/domain/segmentCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ export function doStartSegmentCollection(
flushSegment('view_change')
})

const { unsubscribe: unsubscribeSessionRenewed } = lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
flushSegment('session_renewed')
})

const { unsubscribe: unsubscribeBeforeUnload } = lifeCycle.subscribe(LifeCycleEventType.BEFORE_UNLOAD, () => {
flushSegment('before_unload')
})
Expand Down Expand Up @@ -128,7 +124,6 @@ export function doStartSegmentCollection(
unsubscribeViewCreated()
unsubscribeBeforeUnload()
unsubscribeVisibilityChange()
unsubscribeSessionRenewed()
worker.terminate()
},
}
Expand Down
1 change: 0 additions & 1 deletion packages/rum-recorder/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export type CreationReason =
| 'max_duration'
| 'max_size'
| 'view_change'
| 'session_renewed'
| 'before_unload'
| 'visibility_hidden'

Expand Down

0 comments on commit 89d53e1

Please sign in to comment.