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

[argus] few tweaks #4925

Merged
merged 4 commits into from
Oct 16, 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
8 changes: 7 additions & 1 deletion distributor-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
##

### 1.4.0

- Add 1s delay between fetching pages for QN state sync. This will allow QN to have some breathing space and process other requests that may have been stuck because of heavy processing.
- Add `Access-Control-Expose-Headers` response header to allow web clients checking cache status of downloaded file.
- Include response headers in `http` logs

### 1.3.1

- Batch fetching of objects details from query-node [#4921](https://github.com/Joystream/joystream/pull/4921)
- **FIX** QN state sync: The QN state sync that runs on startup and on interval, has been split to multiple paginated queries so that it doesn't crash QN's GraphQL server because of huge payload: [#4921](https://github.com/Joystream/joystream/pull/4921)

### 1.3.0

Expand Down
2 changes: 1 addition & 1 deletion distributor-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/distributor-cli",
"description": "Joystream distributor node CLI",
"version": "1.3.1",
"version": "1.4.0",
"author": "Joystream contributors",
"bin": {
"joystream-distributor": "./bin/run"
Expand Down
5 changes: 4 additions & 1 deletion distributor-node/src/services/httpApi/HttpApiBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export abstract class HttpApiBase {
winstonInstance: this.logger,
level: 'http',
dynamicMeta: (req, res) => {
return { prematurelyClosed: res.locals.prematurelyClosed ?? false }
return {
prematurelyClosed: res.locals.prematurelyClosed ?? false,
res: { headers: res.getHeaders(), statusCode: res.statusCode },
}
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions distributor-node/src/services/httpApi/controllers/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export class PublicApiController {
res.setHeader('timing-allow-origin', '*')
res.setHeader('accept-ranges', 'bytes')
res.setHeader('content-disposition', 'inline')
res.setHeader('access-control-expose-headers', 'x-cache, x-data-source')

switch (objectStatus.type) {
case ObjectStatusType.Available:
Expand Down Expand Up @@ -271,6 +272,7 @@ export class PublicApiController {
})

res.setHeader('timing-allow-origin', '*')
res.setHeader('access-control-expose-headers', 'x-cache, x-data-source')

switch (objectStatus.type) {
case ObjectStatusType.Available:
Expand Down
2 changes: 2 additions & 0 deletions distributor-node/src/services/networking/query-node/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ export class QueryNodeApi {
GetDataObjectsWithBagsByIdsQueryVariables
>(GetDataObjectsWithBagsByIds, { bagIds: bagIdsBatch, limit: bagIdsBatch.length }, 'storageBags'))
)
// wait 1s between requests to avoid overloading the query node
await new Promise((resolve) => setTimeout(resolve, 1000))
}

return fullResult.map((bag) => bag.objects).flat()
Expand Down
Loading