Skip to content

Commit

Permalink
Upped limits
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen committed Oct 2, 2024
1 parent 293f0bc commit 39bc9ce
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
15 changes: 15 additions & 0 deletions files/defaultActions.owned.json
Original file line number Diff line number Diff line change
Expand Up @@ -973,5 +973,20 @@
"path": "spawning.spawnUptimePercentage",
"value": 0,
"type": 0
},
{
"path": "resourcesStored.score",
"value": 0,
"type": 1
},
{
"path": "controller.gclPerTick_upgraded",
"value": 0,
"type": 0
},
{
"path": "controller.rclPerTick_upgraded",
"value": 0,
"type": 0
}
]
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"https-proxy-agent": "^7.0.2",
"jest": "^29.7.0",
"postgres": "^3.4.3",
"screeps-advanced-api": "^1.5.0",
"screeps-advanced-api": "^1.5.2",
"screeps-api": "^1.16.0",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1"
Expand Down
19 changes: 18 additions & 1 deletion src/setup/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const userRoomsCache = cleanSource(baseCache)
export default class Cache {
static shouldUpdateCache(type) {
let cache;
const shouldUpdateInterval = 1000 * 60 * 30;
const shouldUpdateInterval = 1000 * 60 * 10;
switch (type) {
case 'rooms':
cache = roomsCache;
Expand Down Expand Up @@ -124,6 +124,23 @@ export default class Cache {
roomsCache.data = shards;
}

static async updateUserLeaderboardCache() {
const forcedUsers = process.env.USERNAMES && process.env.USERNAMES.length > 0
? ("Unknown," + process.env.USERNAMES).split(",") : [];
let users = await advancedScreepsApi.getAllUsers()
users = users.filter(forcedUsers.length > 0 ? (user) => forcedUsers.includes(user.username) : () => true);
users.sort((a, b) => GetRoomTotal(b.shards, 'type') - GetRoomTotal(a.shards, 'type'));
const userValues = Object.values(users);

for (let u = 0; u < userValues.length; u += 1) {
const user = userValues[u];
ProcessDataBroker.usernamesById[user.id] = user.username;
}
fs.writeFileSync("./files/users.json", JSON.stringify(users, null, 2));
UpdateLocalUsersCache(users);
usersCache.data = users;
}

static async updateUsersCache() {
const forcedUsers = process.env.USERNAMES && process.env.USERNAMES.length > 0
? ("Unknown," + process.env.USERNAMES).split(",") : [];
Expand Down

0 comments on commit 39bc9ce

Please sign in to comment.