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

chore(server): Cleanup unused GraphQL subscriptions #2930

Merged
merged 1 commit into from
Oct 28, 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
74 changes: 0 additions & 74 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions packages/openneuro-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"graphql-bigint": "^1.0.0",
"graphql-compose": "9.0.10",
"graphql-iso-date": "^3.6.1",
"graphql-redis-subscriptions": "2.1.0",
"graphql-subscriptions": "^1.1.0",
"graphql-tools": "9.0.0",
"immutable": "^3.8.2",
"ioredis": "4.17.3",
Expand Down
16 changes: 0 additions & 16 deletions packages/openneuro-server/src/datalad/snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { reindexDataset } from '../elasticsearch/reindex-dataset'
import { redis, redlock } from '../libs/redis'
import CacheItem, { CacheType } from '../cache/item'
import config from '../config.js'
import pubsub from '../graphql/pubsub.js'
import {
updateDatasetName,
snapshotCreationComparison,
Expand Down Expand Up @@ -109,14 +108,6 @@ const announceNewSnapshot = async (snapshot, datasetId, user) => {
if (snapshot.files) {
notifications.snapshotCreated(datasetId, snapshot, user) // send snapshot notification to subscribers
}
pubsub.publish('snapshotsUpdated', {
datasetId,
snapshotsUpdated: {
id: datasetId,
snapshots: await getSnapshots(datasetId),
latestSnapshot: snapshot,
},
})
}

/**
Expand Down Expand Up @@ -193,13 +184,6 @@ export const deleteSnapshot = (datasetId, tag) => {
tag,
])
await snapshotCache.drop()
pubsub.publish('snapshotsUpdated', {
datasetId,
snapshotsUpdated: {
id: datasetId,
snapshots: await getSnapshots(datasetId),
},
})
return body
})
}
Expand Down
13 changes: 0 additions & 13 deletions packages/openneuro-server/src/graphql/resolvers/dataset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as datalad from '../../datalad/dataset.js'
import pubsub from '../pubsub.js'
import { removeDatasetSearchDocument } from '../../graphql/resolvers/dataset-search.js'
import { snapshots, latestSnapshot } from './snapshots.js'
import { description } from './description.js'
Expand Down Expand Up @@ -134,10 +133,6 @@ export const deleteDataset = async (
redirect,
user: { _id: user },
}).save()
await pubsub.publish('datasetDeleted', {
datasetId: id,
datasetDeleted: id,
})
return deleted
}

Expand All @@ -152,14 +147,6 @@ export const deleteFiles = async (
try {
await checkDatasetWrite(datasetId, user, userInfo)
const deletedFiles = await datalad.deleteFiles(datasetId, files, userInfo)
pubsub.publish('filesUpdated', {
datasetId,
filesUpdated: {
action: 'DELETE',
payload: deletedFiles,
},
})

return true
} catch (err) {
return false
Expand Down
13 changes: 1 addition & 12 deletions packages/openneuro-server/src/graphql/resolvers/description.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { setDescription } from '../../datalad/description.js'
import { checkDatasetWrite } from '../permissions.js'
export { description } from '../../datalad/description.js'
import pubsub from '../pubsub.js'

export const updateDescription = (
obj,
Expand All @@ -13,17 +12,7 @@ export const updateDescription = (
) => {
return checkDatasetWrite(datasetId, user, userInfo)
.then(() => setDescription(datasetId, userInfo, { [field]: value }))
.then(description => {
pubsub.publish('draftUpdated', {
datasetId: description.id,
draftUpdated: {
draft: {
description,
},
},
})
return description
})
.then(description => description)
}

export const updateDescriptionList = updateDescription
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import User, { UserDocument } from '../../models/user'
import Permission, { PermissionDocument } from '../../models/permission'
import { checkDatasetAdmin } from '../permissions'
import { user } from './user'
import pubsub from '../pubsub.js'

interface DatasetPermission {
id: string
Expand Down Expand Up @@ -40,10 +39,6 @@ const publishPermissions = async datasetId => {
),
},
}
pubsub.publish('permissionsUpdated', {
datasetId,
permissionsUpdated,
})
}

/**
Expand Down
81 changes: 0 additions & 81 deletions packages/openneuro-server/src/graphql/resolvers/subscriptions.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/openneuro-server/src/graphql/schema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-nocheck
import { schemaComposer } from 'graphql-compose'
import resolvers from './resolvers'
import Subscription from './resolvers/subscriptions.js'
import {
datasetSearch,
advancedDatasetSearch,
Expand Down Expand Up @@ -818,7 +817,6 @@ export const typeDefs = `

schemaComposer.addTypeDefs(typeDefs)
schemaComposer.addResolveMethods(resolvers)
schemaComposer.Subscription.addFields(Subscription)
schemaComposer.Query.addFields(datasetSearch)
schemaComposer.Query.addFields(advancedDatasetSearch)

Expand Down
5 changes: 0 additions & 5 deletions packages/openneuro-server/src/libs/redis-pubsub.js

This file was deleted.

20 changes: 0 additions & 20 deletions packages/openneuro-server/src/libs/subscription-server.js

This file was deleted.

Loading