Skip to content

Commit

Permalink
Checking for type of forceSyncInterval (#817)
Browse files Browse the repository at this point in the history
Protection from stupid error when you set forceSyncInterval to true and DDoS your server
  • Loading branch information
SynteZZZ authored May 12, 2024
1 parent 5d63637 commit 1af781a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/provider/src/HocuspocusProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ export class HocuspocusProvider extends EventEmitter {
this.awareness?.on('update', this.awarenessUpdateHandler.bind(this))
this.registerEventListeners()

if (this.configuration.forceSyncInterval) {
if (
this.configuration.forceSyncInterval
&& typeof this.configuration.forceSyncInterval === 'number'
) {
this.intervals.forceSync = setInterval(
this.forceSync.bind(this),
this.configuration.forceSyncInterval,
Expand Down

0 comments on commit 1af781a

Please sign in to comment.