Skip to content

Commit

Permalink
chore: lint peer routing (#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Mar 5, 2023
1 parent 75b71fa commit 93fc6d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/peer-record-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ export class PeerRecordUpdater implements Startable {
this.update = this.update.bind(this)
}

isStarted () {
isStarted (): boolean {
return this.started
}

async start () {
async start (): Promise<void> {
this.started = true
this.components.transportManager.addEventListener('listener:listening', this.update)
this.components.transportManager.addEventListener('listener:close', this.update)
this.components.addressManager.addEventListener('change:addresses', this.update)
}

async stop () {
async stop (): Promise<void> {
this.started = false
this.components.transportManager.removeEventListener('listener:listening', this.update)
this.components.transportManager.removeEventListener('listener:close', this.update)
Expand All @@ -47,7 +47,7 @@ export class PeerRecordUpdater implements Startable {
/**
* Create (or update if existing) self peer record and store it in the AddressBook.
*/
update () {
update (): void {
Promise.resolve()
.then(async () => {
const peerRecord = new PeerRecord({
Expand Down
8 changes: 4 additions & 4 deletions src/peer-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ export class DefaultPeerRouting implements PeerRouting, Startable {
this._findClosestPeersTask = this._findClosestPeersTask.bind(this)
}

isStarted () {
isStarted (): boolean {
return this.started
}

/**
* Start peer routing service.
*/
async start () {
async start (): Promise<void> {
if (this.started || this.routers.length === 0 || this.timeoutId != null || this.refreshManagerInit.enabled === false) {
return
}
Expand All @@ -98,7 +98,7 @@ export class DefaultPeerRouting implements PeerRouting, Startable {
/**
* Recurrent task to find closest peers and add their addresses to the Address Book.
*/
async _findClosestPeersTask () {
async _findClosestPeersTask (): Promise<void> {
if (this.abortController != null) {
// we are already running the query
return
Expand Down Expand Up @@ -127,7 +127,7 @@ export class DefaultPeerRouting implements PeerRouting, Startable {
/**
* Stop peer routing service.
*/
async stop () {
async stop (): Promise<void> {
clearDelayedInterval(this.timeoutId)

// abort query if it is in-flight
Expand Down

0 comments on commit 93fc6d4

Please sign in to comment.