File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ const SESSION_INTERVAL = 90 // in seconds
2727
2828let hasPush = false
2929
30+ let syncRunning = false
31+
3032/**
3133 * used to verify, whether an event is originated by ourselves
3234 *
@@ -103,12 +105,24 @@ export function createSession(boardId) {
103105 create ( )
104106 return
105107 }
108+
109+ if ( syncRunning ) {
110+ return
111+ }
112+
106113 try {
114+ syncRunning = true
107115 await sessionApi . syncSession ( boardId , await tokenPromise )
108116 } catch ( err ) {
109- // session probably expired, let's
110- // create a fresh session
111- create ( )
117+ if ( err . response . status === 404 ) {
118+ // session probably expired, let's
119+ // create a fresh session
120+ create ( )
121+ } else {
122+ console . error ( 'Failed to sync deck session' , err )
123+ }
124+ } finally {
125+ syncRunning = false
112126 }
113127 }
114128
@@ -134,6 +148,7 @@ export function createSession(boardId) {
134148 store . dispatch ( 'refreshBoard' , store . state . currentBoard ?. id )
135149
136150 // restart session refresh interval
151+ clearInterval ( interval )
137152 interval = setInterval ( ensureSession , SESSION_INTERVAL * 1000 )
138153 }
139154 }
You can’t perform that action at this time.
0 commit comments