File tree Expand file tree Collapse file tree 6 files changed +58
-68
lines changed
Expand file tree Collapse file tree 6 files changed +58
-68
lines changed Original file line number Diff line number Diff line change 88
99// const BULL_REDIS_URI = 'redis://127.0.0.1:6379';
1010const BULL_REDIS_URI =
11- 'redis://:uut2tiew5waeli1aefup0Toecaikoque5eepahch5AowaiJ2@10.216.129.127 :6379' ;
11+ 'redis://:uut2tiew5waeli1aefup0Toecaikoque5eepahch5AowaiJ2@10.216.129.128 :6379' ;
1212
1313const BULL_HOST_ID = 'maybe_uuid_and_mac' ;
1414
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ if (!BULL_REDIS_URI) {
99export const queueSettings = {
1010 hostId : BULL_HOST_ID ,
1111 name : 'fetch_metrics' ,
12- prefix : 'bull.fetch-metrics ' ,
12+ prefix : 'bull.demo ' ,
1313} ;
1414
1515const prefix = queueSettings . prefix ;
Original file line number Diff line number Diff line change 1+ import { isObject , SchemaComposer } from 'graphql-compose' ;
2+
3+ export function createRepeatOptionsTC ( schemaComposer : SchemaComposer < any > ) {
4+ const RepeatOptionsInterfaceTC = schemaComposer . createInterfaceTC ( {
5+ name : 'RepeatOptionsInterface' ,
6+ fields : {
7+ tz : 'String' ,
8+ endDate : 'Date' ,
9+ limit : 'Int' ,
10+ } ,
11+ } ) ;
12+
13+ const RepeatOptionsCronTC = schemaComposer . createObjectTC ( {
14+ name : 'RepeatOptionsCron' ,
15+ interfaces : [ RepeatOptionsInterfaceTC ] ,
16+ fields : {
17+ tz : 'String' ,
18+ endDate : 'Date' ,
19+ limit : 'Int' ,
20+ cron : 'String' ,
21+ startDate : 'Date' ,
22+ } ,
23+ } ) ;
24+
25+ const RepeatOptionsEveryTC = schemaComposer . createObjectTC ( {
26+ name : 'RepeatOptionsEvery' ,
27+ interfaces : [ RepeatOptionsInterfaceTC ] ,
28+ fields : {
29+ tz : 'String' ,
30+ endDate : 'Date' ,
31+ limit : 'Int' ,
32+ every : 'String' ,
33+ } ,
34+ } ) ;
35+
36+ RepeatOptionsInterfaceTC . addTypeResolver ( RepeatOptionsEveryTC , ( value ) => {
37+ return isObject ( value ) && value . hasOwnProperty ( 'every' ) ;
38+ } ) ;
39+
40+ RepeatOptionsInterfaceTC . addTypeResolver ( RepeatOptionsCronTC , ( value ) => {
41+ return isObject ( value ) && value . hasOwnProperty ( 'cron' ) ;
42+ } ) ;
43+
44+ schemaComposer . addSchemaMustHaveType ( RepeatOptionsEveryTC ) ;
45+ schemaComposer . addSchemaMustHaveType ( RepeatOptionsCronTC ) ;
46+
47+ return RepeatOptionsInterfaceTC ;
48+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import { createLogsFC } from './logs' ;
22import { createStateFC } from './state' ;
3- import { createRepeatOptionsTC } from './RepeatOptionsUnion ' ;
3+ import { createRepeatOptionsTC } from './RepeatOptionsInterface ' ;
44import { SchemaComposer } from 'graphql-compose' ;
55
66export { getJobOptionsInputTC } from './OptionsInput' ;
Original file line number Diff line number Diff line change 1- import { Job } from 'bullmq' ;
1+ import { Job , Queue } from 'bullmq' ;
22import { SchemaComposer , ObjectTypeComposerFieldConfigDefinition } from 'graphql-compose' ;
33
44export function createLogsFC (
@@ -9,14 +9,17 @@ export function createLogsFC(
99 name : 'JobLogs' ,
1010 fields : {
1111 count : 'Int' ,
12- logs : '[String!]' ,
12+ items : '[String!]' ,
1313 } ,
14+ // args: {}, // TODO: start end
1415 } ) ,
1516 resolve : ( job : Job ) => {
1617 // `queue` is private property of Job instance
1718 // so here we are not guarantee that log will be avaliable in the future
18- if ( ( job as any ) . queue ) {
19- return ( job as any ) . queue . getJobLogs ( job . id ) ;
19+ if ( job . id && ( job as any ) . queue ) {
20+ return ( ( job as any ) . queue as Queue )
21+ . getJobLogs ( job . id )
22+ . then ( ( r ) => ( { count : r . count , items : r . logs } ) ) ;
2023 }
2124 } ,
2225 } ;
You can’t perform that action at this time.
0 commit comments