-
Notifications
You must be signed in to change notification settings - Fork 38
ISSUE-174 #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ISSUE-174 #182
Conversation
|
@Ayaanshaikh12243 is attempting to deploy a commit to the Divya Tiwari's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for tiwaridivya25-devconnect ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hi @Ayaanshaikh12243, Please link an issue using one of the following formats:
Linking issues helps us track work and close issues automatically. Thanks! 🙌 |
Thanks for creating a PR for your Issue!
|
|
@TiwariDivya25 please check mam thank you |
|
@Ayaanshaikh12243 Please follow the PR template and link the issue number in the given format. |
|
@TiwariDivya25 mam please share the template |
|
@TiwariDivya25 where is the template please share mam |
#174
// Before: 30 seconds (excessive)
const interval = setInterval(updatePresence, 30000);
// After: 2 minutes (optimized)
const interval = setInterval(updatePresence, 120000);
Copy
typescript
2. Connection Pooling Implemented:
// Shared channels instead of multiple connections
const messageChannels = new Map<number, any>();
const channelSubscribers = new Map<number, Set<() => void>>();
let sharedPresenceChannel: any = null;
Copy
typescript
3. Proper Cleanup:
// Clean up shared channel if no subscribers
if (presenceSubscribers.size === 0 && sharedPresenceChannel) {
supabase.removeChannel(sharedPresenceChannel);
sharedPresenceChannel = null;
}
Copy
typescript
4. Error Handling Added:
try {
await supabase.from('UserPresence').upsert({...});
} catch (error) {
console.warn('Failed to update presence:', error);
}
Copy
typescript
Performance Improvements:
75% less network requests (2 min vs 30 sec intervals)
Connection pooling prevents multiple channels
Memory leak prevention with proper cleanup
Error resilience with try-catch blocks
Issue #174 resolved! 🚀