fix(xmpp) Adds logs for shard changed events#2975
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds logging for shard changed events in the XMPP connection handling code to improve observability and debugging capabilities.
Changes:
- Added debug and error logging when shard changes are detected
- Added a warning log when the x-jitsi-shard header is missing in keep-alive responses
- Modified the shard change detection logic to ignore cases where the shard header is absent rather than treating them as shard changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/xmpp/xmpp.ts | Adds logging statements for both graceful reconnect and forced reload paths when a shard change is detected |
| modules/xmpp/XmppConnection.ts | Adds defensive null check and warning log for missing shard header, preventing false shard change detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| JitsiConnectionErrors.SHARD_CHANGED_ERROR | ||
| ); | ||
| } else { | ||
| logger.error('Shard changed, kicking the user off the conference and forcing reload', JSON.stringify(details)); |
There was a problem hiding this comment.
The logger from @jitsi/logger accepts objects directly as additional parameters, so JSON.stringify is unnecessary here. This is inconsistent with other logger usage in the codebase. For example, in XmppConnection.ts line 585, logger.error is called with an object parameter directly: logger.error('Websocket Keep alive failed for url: ${url}', { error }). Similarly, in xmpp.ts line 1330, an error object is passed directly: logger.error('Error parsing json ${jsonString}', e). Pass the details object directly as a second parameter instead of stringifying it.
| logger.error('Shard changed, kicking the user off the conference and forcing reload', JSON.stringify(details)); | |
| logger.error('Shard changed, kicking the user off the conference and forcing reload', details); |
No description provided.