Skip to content

Commit

Permalink
When no tick, wait until tick is known
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen committed Feb 2, 2024
1 parent 73f82f2 commit 20a2bb1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM node:16.7.0
FROM node:18.18.0
ENV NODE_ENV=production

WORKDIR /usr/app
Expand Down
2 changes: 1 addition & 1 deletion src/data/broker/processData.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class ProcessDataBroker {
if (process.env.CHECK_FOR_NEW_ACTIONS === "TRUE")
ActionProcessor.FindNewDefaultActions(actionsArray, opts.type);

return { data: ActionProcessor.getStats(actionsArray) };
return ActionProcessor.getStats(actionsArray);
} catch (e) {
console.error(e);
throw e;
Expand Down
2 changes: 2 additions & 0 deletions src/data/combineResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@ export default function handleCombinedRoomStats(shardsData, userData) {
if (process.env.ONLY_COMBINED_DATA_UPLOAD === "true")
delete userStats.shards;

userStats.userData = userData;

return { stats: userStats }
}
10 changes: 7 additions & 3 deletions src/helper/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export function getSyncedTick(shard) {
}
if (!syncedTicks[shard]) {
// eslint-disable-next-line no-nested-ternary
let tick = process.env.MIN_TICK !== undefined
? Number.parseInt(process.env.MIN_TICK || "-1", 10)
: lastLiveTicks[shard] ? lastLiveTicks[shard] - 1000 : 0;
let tick;

if (process.env.MIN_TICK !== undefined) tick = Number.parseInt(process.env.MIN_TICK || "-1", 10)
else if (lastLiveTicks[shard]) tick = lastLiveTicks[shard] - 1000;
else {
return undefined;
}
tick = Math.round(tick / 100) * 100

syncedTicks[shard] = tick;
Expand Down

0 comments on commit 20a2bb1

Please sign in to comment.