Skip to content

Commit

Permalink
Fix overriding or shadowing a variable code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
pvarentsov committed Apr 29, 2021
1 parent 5e440a6 commit 22b12d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pg-notify/pg-notify.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger, LoggerService } from '@nestjs/common';
import { CustomTransportStrategy, MessageHandler, Server } from '@nestjs/microservices';
import { NO_EVENT_HANDLER, NO_MESSAGE_HANDLER } from '@nestjs/microservices/constants';
import createSubscriber, { Subscriber } from 'pg-listen';
import { of, Subscription, ConnectableObservable } from 'rxjs';
import { ConnectableObservable, of, Subscription } from 'rxjs';
import { catchError, map, publish } from 'rxjs/operators';
import { PG_NOTIFY_TRANSPORT } from './pg-notify.constant';
import { PgNotifyContext } from './pg-notify.context';
Expand Down Expand Up @@ -138,11 +138,11 @@ export class PgNotifyServer extends Server implements CustomTransportStrategy {

private async handleAsRequest(channel: string, id: string, data: any, ctx: PgNotifyContext): Promise<Subscription> {
const handler = this.getHandlerByPattern(channel);
const publish = this.getPublisher(channel, id);
const publisher = this.getPublisher(channel, id);

if (!handler) {
const response$ = of(PgNotifyResponse.error(NO_MESSAGE_HANDLER, 404));
return this.send(response$, publish);
return this.send(response$, publisher);
}

try {
Expand All @@ -152,11 +152,11 @@ export class PgNotifyServer extends Server implements CustomTransportStrategy {
catchError(err => of(PgNotifyResponse.error(parseErrorMessage(err))))
);

return this.send(response$, publish);
return this.send(response$, publisher);
}
catch (err) {
const response$ = of(PgNotifyResponse.error(parseErrorMessage(err)));
return this.send(response$, publish);
return this.send(response$, publisher);
}
}

Expand Down

0 comments on commit 22b12d6

Please sign in to comment.