@@ -9,12 +9,10 @@ import { EVENTS, GRAPHQL_PUBSUB_CHANNEL, GRAPHQL_PUBSUB_TOKEN } from '../helper/
99import { MothershipConnectionService } from './connection.service.js' ;
1010import { MothershipGraphqlClientService } from './graphql.client.js' ;
1111import { MothershipSubscriptionHandler } from './mothership-subscription.handler.js' ;
12- import { isEqual } from 'lodash-es' ;
1312
1413@Injectable ( )
1514export class MothershipHandler implements OnModuleDestroy {
1615 private readonly logger = new Logger ( MothershipHandler . name ) ;
17- private isSettingUp = false ;
1816 constructor (
1917 private readonly connectionService : MothershipConnectionService ,
2018 private readonly clientService : MothershipGraphqlClientService ,
@@ -37,25 +35,16 @@ export class MothershipHandler implements OnModuleDestroy {
3735 }
3836
3937 async setup ( ) {
40- // if (this.isSettingUp) {
41- // this.logger.debug('Setup already in progress, skipping');
42- // return;
43- // }
44- this . isSettingUp = true ;
45- try {
46- await this . clear ( ) ;
47- const { state } = this . connectionService . getIdentityState ( ) ;
48- this . logger . verbose ( 'cleared, got identity state' ) ;
49- if ( ! state . apiKey ) {
50- this . logger . warn ( 'No API key found; cannot setup mothership subscription' ) ;
51- return ;
52- }
53- await this . clientService . createClientInstance ( ) ;
54- await this . subscriptionHandler . subscribeToMothershipEvents ( ) ;
55- this . timeoutCheckerJob . start ( ) ;
56- } finally {
57- this . isSettingUp = false ;
38+ await this . clear ( ) ;
39+ const { state } = this . connectionService . getIdentityState ( ) ;
40+ this . logger . verbose ( 'cleared, got identity state' ) ;
41+ if ( ! state . apiKey ) {
42+ this . logger . warn ( 'No API key found; cannot setup mothership subscription' ) ;
43+ return ;
5844 }
45+ await this . clientService . createClientInstance ( ) ;
46+ await this . subscriptionHandler . subscribeToMothershipEvents ( ) ;
47+ this . timeoutCheckerJob . start ( ) ;
5948 }
6049
6150 @OnEvent ( EVENTS . IDENTITY_CHANGED , { async : true } )
0 commit comments