Skip to content

Commit

Permalink
[keyserver] Prefetch URL facts in scripts
Browse files Browse the repository at this point in the history
Summary:
`make-channel-private.js` was crashing because `updateThread` calls `fetchServerThreadInfos`, which ends up calling `getUploadURL` for thread avatars (recent change).

`getUploadURL` needs to know the URL facts to construct the URL. I can pass those in via envvar when invoking the script, but I need this change in order for the URL facts to be loaded.

Test Plan:
On my keyserver:

```
# enter Docker container for Node.js
docker exec -it ba4b6d866573 /bin/bash
# run the make-channel-private.js script, while passing in the URL facts as an envvar
COMM_JSONCONFIG_facts_commapp_url='{"baseDomain":"https://web.comm.app","basePath":"/","https":true,"baseRoutePath":"/commweb/","proxy":"apache"}' yarn script dist/scripts/make-channel-private.js
```

Reviewers: ginsu, atul

Reviewed By: ginsu

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8696
  • Loading branch information
Ashoat committed Aug 1, 2023
1 parent c700760 commit 8602a0a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions keyserver/src/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { endPool } from '../database/database.js';
import { endFirebase, endAPNs } from '../push/providers.js';
import { publisher } from '../socket/redis.js';
import { prefetchAllURLFacts } from '../utils/urls.js';

function endScript() {
endPool();
Expand All @@ -12,6 +13,7 @@ function endScript() {
}

async function main(functions: $ReadOnlyArray<() => Promise<mixed>>) {
await prefetchAllURLFacts();
try {
for (const f of functions) {
await f();
Expand Down

0 comments on commit 8602a0a

Please sign in to comment.