Skip to content

Commit

Permalink
Correcting the Promise RPC Client options.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-barbosa-oliveira committed Mar 29, 2021
1 parent 63f1787 commit 48f00a8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amqp-client-node",
"version": "1.0.10",
"version": "1.0.11",
"description": "Library for publish and subscribe events on message bus. In addition, it is possible to perform resource requests from the use of the standard commonly known as RPC.",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/application/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Connection implements IConnection {
optOrCall?: IClientOptions | ((err, message: any) => void),
options?: IClientOptions): any {
if (!(optOrCall instanceof Function)) {
return this.rpcClientPromise(exchangeName, resourceName, parameters, options)
return this.rpcClientPromise(exchangeName, resourceName, parameters, optOrCall)
}
this.rpcClientCallback(exchangeName, resourceName, parameters, optOrCall, options)
}
Expand Down
2 changes: 1 addition & 1 deletion src/application/port/communication.option.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ISubExchangeOptions {

export interface IClientOptions {
exchange?: IExchangeOptions,
rcpTimeout?: number
rpcTimeout?: number
}

export interface IServerOptions {
Expand Down
6 changes: 4 additions & 2 deletions src/infrastructure/rabbitmq/rpc/client.register.rabbitmq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IClientOptions } from '../../../application/port/communication.option.i
import { IMessage } from '../../../application/port/message.interface'

const defClientOptions: IClientOptions = {
rcpTimeout: 5000
rpcTimeout: 5000
}

@injectable()
Expand All @@ -35,8 +35,10 @@ export class ClientRegisterRabbitmq implements IClientRegister {
const exchange = this._connection.getExchange(exchangeName, options ? options.exchange : undefined)
await exchange.initialized

if (!options.rpcTimeout) options.rpcTimeout = defClientOptions.rpcTimeout

let time
const timeout = options.rcpTimeout
const timeout = options.rpcTimeout

if (timeout > 0) {
new Promise<any>((res) => {
Expand Down

0 comments on commit 48f00a8

Please sign in to comment.