Skip to content

Commit 0438003

Browse files
committed
Clarify naming convention
1 parent 6f37230 commit 0438003

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

packages/backend/src/nest/qss/qss-auth-conn-manager.service.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,53 +58,53 @@ describe('QSSAuthConnectionManager', () => {
5858
const conn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
5959
expect(conn).toBeDefined()
6060
expect(conn?.joinStatus).toBe(JoinStatus.JOINED)
61-
expect(conn?.active).toBeTruthy()
61+
expect(conn?.running).toBeTruthy()
6262
})
6363

6464
it(`doesn't start a new connection when an existing connection is in place`, async () => {
6565
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
6666
const conn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
6767
expect(conn).toBeDefined()
6868
expect(conn?.joinStatus).toBe(JoinStatus.JOINED)
69-
expect(conn?.active).toBeTruthy()
69+
expect(conn?.running).toBeTruthy()
7070

7171
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
7272
const possiblyNewConn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
7373
expect(possiblyNewConn).toBeDefined()
7474
expect(possiblyNewConn!.id).toEqual(conn!.id)
75-
expect(possiblyNewConn?.active).toBeTruthy()
75+
expect(possiblyNewConn?.running).toBeTruthy()
7676
})
7777

7878
it(`restarts existing connection when a connection is in place but isn't active`, async () => {
7979
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
8080
const conn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
8181
expect(conn).toBeDefined()
8282
expect(conn?.joinStatus).toBe(JoinStatus.JOINED)
83-
expect(conn?.active).toBeTruthy()
83+
expect(conn?.running).toBeTruthy()
8484
conn?.stop(false)
85-
expect(conn?.active).toBeFalsy()
85+
expect(conn?.running).toBeFalsy()
8686

8787
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
8888
const possiblyNewConn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
8989
expect(possiblyNewConn).toBeDefined()
9090
expect(possiblyNewConn!.id).toEqual(conn!.id)
91-
expect(possiblyNewConn?.active).toBeTruthy()
91+
expect(possiblyNewConn?.running).toBeTruthy()
9292
})
9393

9494
it(`starts a new connection when a connection is closed and removed`, async () => {
9595
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
9696
const conn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
9797
expect(conn).toBeDefined()
9898
expect(conn?.joinStatus).toBe(JoinStatus.JOINED)
99-
expect(conn?.active).toBeTruthy()
99+
expect(conn?.running).toBeTruthy()
100100
qssAuthConnManager.stopConnection(sigchainService.activeChain.team!.id)
101-
expect(conn?.active).toBeFalsy()
101+
expect(conn?.running).toBeFalsy()
102102

103103
await qssAuthConnManager.startNewConnection(sigchainService.activeChain.team!.id)
104104
const possiblyNewConn = qssAuthConnManager.getConnection(sigchainService.activeChain.team!.id)
105105
expect(possiblyNewConn).toBeDefined()
106106
expect(possiblyNewConn?.joinStatus).toBe(JoinStatus.JOINED)
107-
expect(possiblyNewConn?.active).toBeTruthy()
107+
expect(possiblyNewConn?.running).toBeTruthy()
108108
expect(possiblyNewConn!.id).not.toEqual(conn!.id)
109109
})
110110
})

packages/backend/src/nest/qss/qss-auth-conn-manager.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class QSSAuthConnectionManager extends EventEmitter implements OnModuleDe
4545
}
4646

4747
const authConnection = this.getConnection(message.payload.teamId)
48-
if (authConnection == null || !authConnection.active) {
48+
if (authConnection == null || !authConnection.running) {
4949
throw new Error(
5050
`Auth connection for team ${message.payload.teamId} wasn't initialized, can't process auth sync message`
5151
)
@@ -79,7 +79,7 @@ export class QSSAuthConnectionManager extends EventEmitter implements OnModuleDe
7979
const existingAuthConnection = this.authConnMap.get(teamId)
8080
// if we have an existing auth connection with QSS for this team and it is active, do nothing
8181
if (existingAuthConnection != null) {
82-
if (existingAuthConnection.active) {
82+
if (existingAuthConnection.running) {
8383
this.logger.warn('Existing active auth connection with QSS found for this team ID', teamId)
8484
return
8585
}

packages/backend/src/nest/qss/qss-auth-conn.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class QSSAuthConnection extends EventEmitter {
103103
* This is true when the connection is starting up or has successfully completed the identity handshake
104104
* and is actively syncing sigchain updates with QSS
105105
*/
106-
public get active(): boolean {
106+
public get running(): boolean {
107107
return [QSSAuthConnStatus.STARTING, QSSAuthConnStatus.ACTIVE].includes(this.connStatus)
108108
}
109109

@@ -141,7 +141,7 @@ export class QSSAuthConnection extends EventEmitter {
141141
if (this._authConnection != null) {
142142
// if we have an existing auth connection for this team check if it has been started and is active, if so
143143
// do nothing
144-
if (this._authConnection._started && this.active) {
144+
if (this._authConnection._started && this.running) {
145145
this.logger.error(`Auth connection already started with QSS for this team`, this.teamId)
146146
return
147147
}
@@ -268,7 +268,7 @@ export class QSSAuthConnection extends EventEmitter {
268268
}
269269

270270
public deliver(message: Uint8Array): void {
271-
if (this._authConnection == null || !this.active) {
271+
if (this._authConnection == null || !this.running) {
272272
throw new Error(`Auth connection with QSS for team ${this.teamId} needs to be initialized!`)
273273
}
274274

0 commit comments

Comments
 (0)