Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state: adjust redis keys to be more consistent #309

Merged
merged 1 commit into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browsertrix-crawler",
"version": "0.10.0-beta.1",
"version": "0.10.0-beta.2",
"main": "browsertrix-crawler",
"type": "module",
"repository": "https://github.com/webrecorder/browsertrix-crawler",
Expand Down
8 changes: 3 additions & 5 deletions util/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export class RedisCrawlState
// crawler errors
this.ekey = this.key + ":e";

this.crawlSizeKey = "crawl-size";

this._initLuaCommands(this.redis);
}

Expand Down Expand Up @@ -205,17 +203,17 @@ return 0;
}

async setArchiveSize(size) {
return await this.redis.hset(this.crawlSizeKey, this.uid, size);
return await this.redis.hset(`${this.key}:size`, this.uid, size);
}

async isCrawlStopped() {
return await this.redis.get("crawl-stop") === "1";
return await this.redis.get(`${this.key}:stopping`) === "1";
}

// note: not currently called in crawler, but could be
// crawl may be stopped by setting this elsewhere in shared redis
async stopCrawl() {
await this.redis.set("crawl-stop", "1");
await this.redis.set(`${this.key}:stopping`, "1");
}

async incFailCount() {
Expand Down