diff --git a/package-lock.json b/package-lock.json index d7a23e223..342194761 100644 --- a/package-lock.json +++ b/package-lock.json @@ -704,9 +704,8 @@ } }, "@gridplus/docker-events": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@gridplus/docker-events/-/docker-events-1.0.0.tgz", - "integrity": "sha512-WtMKFmM9pQ5W594RG+VulhYAWJ3Z95NbHEh1LemFsnm00HE48NkQV1E6NOCwfENJ+h28JU6Dvg+ZjW341RQSrw==", + "version": "github:OmgImAlexis/docker-events#5573b3d41df004774a9661ca68ff7851efb041e4", + "from": "github:OmgImAlexis/docker-events", "requires": { "debug": "^3.1.0", "llog": "^0.1.1", @@ -11979,15 +11978,15 @@ } }, "pino": { - "version": "5.13.4", - "resolved": "https://registry.npmjs.org/pino/-/pino-5.13.4.tgz", - "integrity": "sha512-heeg8m8FZY8Nl3nuuD+msJUmhamqoGl7JXoTExh9YpGajzz6LYbVByUqrjbf4sCEMYFsqdcqnTJWiSY660DraQ==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-5.16.0.tgz", + "integrity": "sha512-k9cDzHd9S/oYSQ9B9g9+7RXkfsZX78sQXERC8x4p2XArECZXULx9nqNwZvJHsLj779wPCt+ybN+dG8jFR70p6Q==", "requires": { "fast-redact": "^2.0.0", "fast-safe-stringify": "^2.0.7", - "flatstr": "^1.0.9", - "pino-std-serializers": "^2.3.0", - "quick-format-unescaped": "^3.0.2", + "flatstr": "^1.0.12", + "pino-std-serializers": "^2.4.2", + "quick-format-unescaped": "^3.0.3", "sonic-boom": "^0.7.5" } }, diff --git a/package.json b/package.json index a8672d9fe..440434c57 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dist" ], "dependencies": { - "@gridplus/docker-events": "^1.0.0", + "@gridplus/docker-events": "github:OmgImAlexis/docker-events", "@unraid/core": "github:unraid/core", "accesscontrol": "^2.2.1", "am": "^1.0.1", diff --git a/src/graphql/schema/resolvers.ts b/src/graphql/schema/resolvers.ts index 37c2ea3f8..af956543f 100644 --- a/src/graphql/schema/resolvers.ts +++ b/src/graphql/schema/resolvers.ts @@ -32,17 +32,20 @@ bus.on('disks', async () => { }); // On Docker event update info with { apps: { installed, started } } -const updatePubsubWithDockerEvent = async () => { +dee.on('*', async (data) => { + // Only listen to container events + if (data.Type !== 'container') { + return; + } + + // Don't publish when we have no clients if (!canPublishToClients()) { return; } const { json } = await core.modules.getApps(); updatePubsub('info', 'UPDATED', json); -}; - -dee.on('start', updatePubsubWithDockerEvent); -dee.on('stop', updatePubsubWithDockerEvent); +}); dee.listen(); diff --git a/src/run.ts b/src/run.ts index 53d2ffdb9..c3f6d0724 100644 --- a/src/run.ts +++ b/src/run.ts @@ -62,12 +62,7 @@ export const run = async (channel: string, mutation: string, options: RunOptions log.debug('Module:', moduleToRun.name, 'Result:', result.json); // Update pubsub channel - pubsub.publish(channel, { - [channel]: { - mutation, - node: result.json - } - }); + updatePubsub(channel, mutation, result.json); } catch (error) { // Ensure we aren't leaking anything in production if (process.env.NODE_ENV === 'production') {