Skip to content

Commit

Permalink
Better roomsUploaded catching
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen authored Mar 20, 2024
1 parent 0d693a2 commit e744d98
Show file tree
Hide file tree
Showing 5 changed files with 9,716 additions and 18 deletions.
7 changes: 0 additions & 7 deletions src/data/converter/manage/ownedRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ export default async function handleObjects(data, opts) {

// #region Controller
if (controller) {
actions.push(
ActionProcessor.CreateAction(
`controller.upgrader`,
controller._upgraded,
ActionProcessor.ActionType.FirstTickOnly
)
);
actions.push(
ActionProcessor.CreateAction(
`controller.level`,
Expand Down
6 changes: 3 additions & 3 deletions src/process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function shouldFail(opts) {
const data = validData[key]
if (!data) return false;

if (data.tick + 1000 > opts.tick) return false
if (data.tick + 500 > opts.tick) return false
delete validData[key]
return true;
}
Expand Down Expand Up @@ -42,7 +42,7 @@ export default async function processData(opts, proxyIndex) {
status: "No user",
}
}
validData[`${opts.shard}-${opts.room}`] = { data: opts.data, tick: opts.tick }
validData[`${opts.shard}-${opts.room}`] = opts;
}
return {
status: "Success",
Expand All @@ -55,7 +55,7 @@ export default async function processData(opts, proxyIndex) {
};
}

opts.data = validData[`${opts.shard}-${opts.room}`] || {};
opts.data = validData[`${opts.shard}-${opts.room}`];
return {
status: "Success",
};
Expand Down
14 changes: 8 additions & 6 deletions src/requests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ export default class Requests {
}
const roomsUploaded = {};
for (let u = 0; u < status.processed.length; u += 1) {
const { shard, room } = status.processed[u];
roomsUploaded[shard] = roomsUploaded[shard] || {};
roomsUploaded[shard][room] = 1;
const { shard, room, username } = status.processed[u];
roomsUploaded[username] = roomsUploaded[username] || {};
roomsUploaded[username][shard] = roomsUploaded[username][shard] || {};
roomsUploaded[username][shard][room] = 1;
}
for (let u = 0; u < status.failed.length; u += 1) {
const { shard, room } = status.failed[u];
roomsUploaded[shard] = roomsUploaded[shard] || {};
roomsUploaded[shard][room] = 1;
const { shard, room, username } = status.failed[u];
roomsUploaded[username] = roomsUploaded[username] || {};
roomsUploaded[username][shard] = roomsUploaded[username][shard] || {};
roomsUploaded[username][shard][room] = 0;
}
await UploadStatus({
cycleDetails:
Expand Down
9,705 changes: 9,704 additions & 1 deletion tests/helper/dataFiles/data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/helper/dataFiles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const opts = {
}
// set id each change in data.json
ProcessDataBroker.usernamesById = {
"58519b0bee6ae29347627228": "username"
"61a475b5048fffe95d98bbcf": "username"
};
const stats = await ProcessDataBroker.single({ roomData, opts });
console.log(stats);

0 comments on commit e744d98

Please sign in to comment.