bito-code-review[bot] commented on PR #43843:
URL: https://github.com/apache/superset/pull/43843#issuecomment-5534177289
<!-- Bito Reply -->
The flagged issue is correct. In the current implementation of
`superset-websocket/src/index.ts`, the `REALTIME_CHANNEL` constant is
initialized at module load time using `opts.realtimeChannelPrefix`. If the
configuration or the prefix resolution logic changes dynamically, the websocket
server will remain subscribed to the initial channel name, missing messages
published to any new channel names.
To resolve this, the websocket server needs to dynamically resolve the
channel name or re-subscribe when the prefix changes. However, since the
websocket server is typically a long-running process, a common pattern is to
ensure the configuration is immutable after startup or to implement a
re-subscription mechanism if the configuration is updated.
Given the current architecture, you can update
`superset-websocket/src/index.ts` to resolve the channel name dynamically when
subscribing, rather than relying on a fixed constant:
```typescript
// superset-websocket/src/index.ts
// Instead of a fixed constant, use a function to resolve the channel name
const getRealtimeChannel = () => `${opts.realtimeChannelPrefix}realtime`;
// Update subscription calls to use the function:
// await mockSubscribe(getRealtimeChannel());
```
I have checked the PR comments and there are no other comments to address.
Would you like me to implement this change or check for any other issues?
**superset-websocket/src/index.ts**
```
const getRealtimeChannel = () => `${opts.realtimeChannelPrefix}realtime`;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]