Skip to content

Commit

Permalink
remove lease aquire from methods that are read only
Browse files Browse the repository at this point in the history
Signed-off-by: instamenta <[email protected]>
  • Loading branch information
instamenta committed Oct 21, 2024
1 parent 1d71020 commit a28245a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
9 changes: 0 additions & 9 deletions src/commands/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ export class AccountCommand extends BaseCommand {
async init (argv: any) {
const self = this

const lease = new LeaseWrapper(self.leaseManager)

interface Context {
config: {
namespace: string
Expand Down Expand Up @@ -157,8 +155,6 @@ export class AccountCommand extends BaseCommand {
self.logger.debug('Initialized config', { config })

await self.accountManager.loadNodeClient(ctx.config.namespace)

return lease.buildAcquireTask(task)
}
},
{
Expand Down Expand Up @@ -244,7 +240,6 @@ export class AccountCommand extends BaseCommand {
} catch (e: Error | any) {
throw new SoloError(`Error in creating account: ${e.message}`, e)
} finally {
await lease.release()
await this.closeConnections()
}

Expand Down Expand Up @@ -330,7 +325,6 @@ export class AccountCommand extends BaseCommand {

async update (argv: any) {
const self = this
const lease = new LeaseWrapper(self.leaseManager)

interface Context {
config: {
Expand Down Expand Up @@ -369,8 +363,6 @@ export class AccountCommand extends BaseCommand {
await self.accountManager.loadNodeClient(config.namespace)

self.logger.debug('Initialized config', { config })

return lease.buildAcquireTask(task)
}
},
{
Expand Down Expand Up @@ -404,7 +396,6 @@ export class AccountCommand extends BaseCommand {
} catch (e: Error | any) {
throw new SoloError(`Error in updating account: ${e.message}`, e)
} finally {
await lease.release()
await this.closeConnections()
}

Expand Down
5 changes: 0 additions & 5 deletions src/commands/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class ClusterCommand extends BaseCommand {
/** Setup cluster with shared components */
async setup (argv: any) {
const self = this
const lease = new LeaseWrapper(self.leaseManager)

interface Context {
config: {
Expand Down Expand Up @@ -100,8 +99,6 @@ export class ClusterCommand extends BaseCommand {
self.logger.debug('Prepare ctx.config', { config: ctx.config, argv })

ctx.isChartInstalled = await this.chartManager.isChartInstalled(ctx.config.clusterSetupNamespace, constants.SOLO_CLUSTER_SETUP_CHART)

return lease.buildAcquireTask(task)
}
},
{
Expand Down Expand Up @@ -156,8 +153,6 @@ export class ClusterCommand extends BaseCommand {
await tasks.run()
} catch (e: Error | any) {
throw new SoloError('Error on cluster setup', e)
} finally {
await lease.release()
}

return true
Expand Down
5 changes: 0 additions & 5 deletions src/commands/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,6 @@ export class NodeCommand extends BaseCommand {

async keys (argv: any) {
const self = this
const lease = new LeaseWrapper(self.leaseManager)

interface NodeKeysConfigClass {
cacheDir: string
Expand Down Expand Up @@ -1188,8 +1187,6 @@ export class NodeCommand extends BaseCommand {
}

ctx.config = config

return lease.buildAcquireTask(task)
}
},
{
Expand Down Expand Up @@ -1239,8 +1236,6 @@ export class NodeCommand extends BaseCommand {
await tasks.run()
} catch (e: Error | any) {
throw new SoloError(`Error generating keys: ${e.message}`, e)
} finally {
await lease.release()
}

return true
Expand Down

0 comments on commit a28245a

Please sign in to comment.