(core) Add unquarantine command to admin CLI

Summary:
Adds a CLI command to un-quarantine an active document. Also tweaks the
name of related environment variable to avoid a naming conflict.

Test Plan: Server test.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3583
This commit is contained in:
George Gevoian
2022-08-15 12:52:38 -07:00
parent 103c795aa2
commit 0c5441b176
4 changed files with 23 additions and 6 deletions

View File

@@ -141,6 +141,10 @@ class DummyDocWorkerMap implements IDocWorkerMap {
// nothing to do
}
public async removeDocGroup(docId: string): Promise<void> {
// nothing to do
}
public getRedisClient() {
return null;
}
@@ -525,6 +529,10 @@ export class DocWorkerMap implements IDocWorkerMap {
await this._client.setAsync(`doc-${docId}-group`, docGroup);
}
public async removeDocGroup(docId: string): Promise<void> {
await this._client.delAsync(`doc-${docId}-group`);
}
public getRedisClient(): RedisClient {
return this._client;
}

View File

@@ -166,12 +166,12 @@ export class Housekeeper {
// actions.
//
// Optionally accepts a `group` query param for updating the document's group prior
// to moving. This is useful for controlling which worker group the document is assigned
// a worker from.
// to moving. A blank string unsets the current group, if any. This is useful for controlling
// which worker group the document is assigned a worker from.
app.post('/api/housekeeping/docs/:docId/assign', this._withSupport(async (req, docId, headers) => {
const url = new URL(await this._server.getHomeUrlByDocId(docId, `/api/docs/${docId}/assign`));
const group = optStringParam(req.query.group);
if (group) { url.searchParams.set('group', group); }
if (group !== undefined) { url.searchParams.set('group', group); }
return fetch(url.toString(), {
method: 'POST',
headers,