File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 - ' v*.*.*'
77
88permissions :
9- contents : write
9+ contents : read
1010 packages : write
1111
1212jobs :
2323 - name : Set up Docker Buildx
2424 uses : docker/setup-buildx-action@v3
2525
26- - name : Bump package.json versions
27- run : |
28- VERSION="${{ github.ref_name }}"
29- VERSION="${VERSION#v}"
30- jq --arg v "$VERSION" '.version = $v' backend/package.json > /tmp/pkg.json && mv /tmp/pkg.json backend/package.json
31- jq --arg v "$VERSION" '.version = $v' frontend/package.json > /tmp/pkg.json && mv /tmp/pkg.json frontend/package.json
32- git config user.name "github-actions[bot]"
33- git config user.email "github-actions[bot]@users.noreply.github.com"
34- git add backend/package.json frontend/package.json
35- git diff --cached --quiet || git commit -m "chore: bump version to ${VERSION}"
36- git push origin HEAD:main
37-
3826 - name : Log in to GHCR
3927 uses : docker/login-action@v3
4028 with :
Original file line number Diff line number Diff line change @@ -155,17 +155,20 @@ await loadIntegrationConfigs();
155155// Start background snooze watcher — polls every 60 seconds to restore snoozed messages
156156imapManager . startSnoozeWatcher ( ) ;
157157
158- // Re-connect all enabled IMAP accounts on startup so mail syncs immediately
159- // even before any WebSocket client connects (covers cold-start and container restarts)
158+ // Re-connect all enabled IMAP accounts on startup, staggered 500 ms apart so a
159+ // large user base doesn't hammer IMAP servers and the DB connection pool at once.
160160try {
161161 const startupResult = await query (
162162 "SELECT DISTINCT user_id FROM email_accounts WHERE enabled = true AND protocol = 'imap'"
163163 ) ;
164- for ( const row of startupResult . rows ) {
165- imapManager . connectAllForUser ( row . user_id ) . catch ( err =>
166- console . error ( `Startup connect failed for user ${ row . user_id } :` , err . message )
164+ startupResult . rows . forEach ( ( { user_id } , i ) => {
165+ setTimeout (
166+ ( ) => imapManager . connectAllForUser ( user_id ) . catch ( err =>
167+ console . error ( `Startup connect failed for user ${ user_id } :` , err . message )
168+ ) ,
169+ i * 500 ,
167170 ) ;
168- }
171+ } ) ;
169172 if ( startupResult . rows . length ) {
170173 console . log ( `Reconnecting accounts for ${ startupResult . rows . length } user(s) on startup` ) ;
171174 }
You can’t perform that action at this time.
0 commit comments