Skip to content

[PB-6311]: feat/get correct user limit after purchase#1942

Merged
xabg2 merged 5 commits intomasterfrom
fix/fetch-user-limit-correctly
May 7, 2026
Merged

[PB-6311]: feat/get correct user limit after purchase#1942
xabg2 merged 5 commits intomasterfrom
fix/fetch-user-limit-correctly

Conversation

@xabg2
Copy link
Copy Markdown
Contributor

@xabg2 xabg2 commented Apr 29, 2026

Description

Refactored the Realtime service (socket connection) by simplifying its initialization: it is now set up when the app mounts and continuously listens for events.

Additionally, a temporary polling mechanism (every 5 secs during 30 secs) has been introduced after a user purchases a plan to ensure their storage is updated correctly.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Additional Notes

@xabg2 xabg2 self-assigned this Apr 29, 2026
@xabg2 xabg2 added the enhancement New feature or request label Apr 29, 2026
@xabg2 xabg2 changed the title feat: get correct user limit after purchase [PB-6311]: feat/get correct user limit after purchase Apr 29, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 29, 2026

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: ba692f0
Status: ✅  Deploy successful!
Preview URL: https://9847289d.drive-web.pages.dev
Branch Preview URL: https://fix-fetch-user-limit-correct.drive-web.pages.dev

View logs

@xabg2 xabg2 marked this pull request as ready for review April 29, 2026 14:11
if (!this.isProduction) {
console.log('[REALTIME]: CONNECTED WITH ID', this.socket?.id);
}
console.log('[REALTIME]: CONNECTED WITH ID', this.socket?.id);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is done on purpose so that it appears in the production environment, and it’s not that you’ve forgotten to put it back :)
I’m just pointing it, just in case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, so we have visibility about the socket connection.

Comment thread src/services/sockets/socket.service.ts Outdated
Comment on lines +47 to +54
switch (data.event) {
case SOCKET_EVENTS.PLAN_UPDATED:
eventHandler.onPlanUpdated(data);
break;
case SOCKET_EVENTS.FILE_CREATED:
eventHandler.onFileCreated(data);
break;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the before implementation was good, now for add more events we have to modify the socket service and not only the event handler :(
Maybe I'm missing something :O

Copy link
Copy Markdown
Contributor Author

@xabg2 xabg2 Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can send the data.event directly to the eventHandler and handle there the events (using the switch). This way, we handle all in the same place, not instantiating it everywhere and using Sets...

Comment thread src/services/sockets/socket.service.ts Outdated
});

this.socket.on('connect_error', (error) => {
if (error.message === 'Session ID unknown') {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be too susceptible to changes in the message. Does it return any code we can use? Although the message doesn't necessarily have to change, the code is usually less susceptible to changes than the message

Copy link
Copy Markdown
Contributor Author

@xabg2 xabg2 Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm seems like socket io does not throw a code within the error. I can use includes instead (ID unknown for example).

@xabg2 xabg2 requested a review from CandelR April 30, 2026 09:11
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@xabg2 xabg2 merged commit 5aeab0e into master May 7, 2026
11 checks passed
@xabg2 xabg2 deleted the fix/fetch-user-limit-correctly branch May 7, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants