keep tilts synced
This commit is contained in:
@@ -21,7 +21,6 @@ const timedReleases = {};
|
||||
|
||||
app.prepare().then(() => {
|
||||
const httpServer = createServer(handler);
|
||||
|
||||
const io = new SocketIOServer(httpServer);
|
||||
|
||||
const broadcast = (event: string, gameUpdate: GameUpdate) => {
|
||||
@@ -32,9 +31,9 @@ app.prepare().then(() => {
|
||||
const timedRelease = (event: string, gameUpdate: GameUpdate, threshold: number) => {
|
||||
const now = Date.now();
|
||||
const lastEvent = timedReleases[event];
|
||||
clearTimeout(lastEvent?.to);
|
||||
|
||||
if (lastEvent?.embargo >= now) {
|
||||
clearTimeout(lastEvent.to);
|
||||
const embargo = lastEvent.embargo - now;
|
||||
|
||||
const to = setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user