mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-05 00:48:44 +00:00
Seperate initial unsub delay from refresh on update unsub delay
This commit is contained in:
@@ -10,6 +10,7 @@ const DEBUG = {
|
|||||||
|
|
||||||
// Delays
|
// Delays
|
||||||
const UNSUB_DELAY = 60 * 1000; //ms
|
const UNSUB_DELAY = 60 * 1000; //ms
|
||||||
|
const REFRESH_DELAY = 60 * 1000; //ms
|
||||||
const REPORT_DELAY = 5 * 1000; //ms
|
const REPORT_DELAY = 5 * 1000; //ms
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ Stream.on('sendUpdate', (event, data)=>{
|
|||||||
if(event == 'brewUpdated'){
|
if(event == 'brewUpdated'){
|
||||||
// Reset the unsubscription timer
|
// Reset the unsubscription timer
|
||||||
clearTimeout(sub.unsubTimer);
|
clearTimeout(sub.unsubTimer);
|
||||||
sub.unsubTimer = setTimeout(()=>{ unsubscribe(sub.id); }, UNSUB_DELAY);
|
sub.unsubTimer = setTimeout(()=>{ unsubscribe(sub.id); }, REFRESH_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub?.stream?.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
sub?.stream?.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
||||||
|
|||||||
Reference in New Issue
Block a user