File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed
example/src/schema/types/queue Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { createCompletedJobsFC } from './completedJobs';
66import { createActiveJobsFC } from './activeJobs' ;
77import { createDelayedJobsFC } from './delayedJobs' ;
88import { createFailedJobsFC } from './failedJobs' ;
9+ import { createWorkersTC } from './workers' ;
910import { SchemaComposer } from 'graphql-compose' ;
1011
1112export function getQueueTC ( sc : SchemaComposer < any > ) {
@@ -22,6 +23,7 @@ export function getQueueTC(sc: SchemaComposer<any>) {
2223 activeJobs : createActiveJobsFC ( sc ) ,
2324 delayedJobs : createDelayedJobsFC ( sc ) ,
2425 failedJobs : createFailedJobsFC ( sc ) ,
26+ workers : createWorkersTC ( sc ) ,
2527 } ) ;
2628 } ) ;
2729}
Original file line number Diff line number Diff line change 1+ import { SchemaComposer } from 'graphql-compose' ;
2+ import { Queue } from 'bullmq' ;
3+
4+ export function createWorkersTC ( schemaComposer : SchemaComposer < any > ) {
5+ return {
6+ type : schemaComposer
7+ . createObjectTC ( {
8+ //https://redis.io/commands/client-list
9+ name : 'QueueWorker' ,
10+ fields : {
11+ clientId : 'String' ,
12+ addr : 'String' ,
13+ fileDescr : 'String' ,
14+ name : 'String' ,
15+ age : 'Int' ,
16+ idle : 'Int' ,
17+ clientFlags : 'String' ,
18+ dbId : 'Int' ,
19+ sub : 'Int' ,
20+ psub : 'Int' ,
21+ multi : 'Int' ,
22+ qbuf : 'Int' ,
23+ qbufFree : 'Int' ,
24+ obl : 'Int' ,
25+ oll : 'Int' ,
26+ omem : 'Int' ,
27+ events : 'String' ,
28+ cmd : 'String' ,
29+ } ,
30+ } )
31+ . getTypePlural ( ) ,
32+ args : { } ,
33+ resolve : async ( queue : Queue ) => {
34+ const workers = await queue . getWorkers ( ) ;
35+ return workers . map ( ( worker ) => ( {
36+ clientId : worker . id ,
37+ addr : worker . addr ,
38+ fileDescr : worker . fd ,
39+ name : worker . name ,
40+ age : worker . age ,
41+ idle : worker . idle ,
42+ clientFlags : worker . flags ,
43+ dbId : worker . db ,
44+ sub : worker . sub ,
45+ psub : worker . psub ,
46+ multi : worker . multi ,
47+ qbuf : worker . qbuf ,
48+ qbufFree : worker [ 'qbuf-free' ] ,
49+ obl : worker . obl ,
50+ oll : worker . id ,
51+ omem : worker . omem ,
52+ events : worker . events ,
53+ cmd : worker . cmd ,
54+ } ) ) ;
55+ } ,
56+ } ;
57+ }
You can’t perform that action at this time.
0 commit comments