Skip to content

Commit

Permalink
fix(server): Add 30 second timeout to dataset resolver
Browse files Browse the repository at this point in the history
Prevents search from hanging indefinitely when one dataset cannot be loaded
  • Loading branch information
nellh committed Mar 5, 2024
1 parent 01cdde5 commit f71d40f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/openneuro-server/src/graphql/resolvers/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import { getDatasetWorker } from "../../libs/datalad-service"
import { getFileName } from "../../datalad/files"
import { onBrainlife } from "./brainlife"
import { derivatives } from "./derivatives"
import { promiseTimeout } from "../../utils/promiseTimeout"
import semver from "semver"

export const dataset = async (obj, { id }, { user, userInfo }) => {
await checkDatasetRead(id, user, userInfo)
return datalad.getDataset(id)
return promiseTimeout(datalad.getDataset(id), 30000)

Check warning on line 28 in packages/openneuro-server/src/graphql/resolvers/dataset.ts

View check run for this annotation

Codecov / codecov/patch

packages/openneuro-server/src/graphql/resolvers/dataset.ts#L28

Added line #L28 was not covered by tests
}

export const datasets = (parent, args, { user, userInfo }) => {
Expand Down

0 comments on commit f71d40f

Please sign in to comment.