gcf-common-lib 0.23.28 → 0.23.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils.js +1 -1
- package/src/utils.ts +3 -3
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -96,7 +96,7 @@ function withAmqpCh(fn, url) {
|
|
|
96
96
|
return withAmqpConn((conn) => __awaiter(this, void 0, void 0, function* () {
|
|
97
97
|
function withDisposer() {
|
|
98
98
|
return bluebird_1.default.method(() => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
return conn.
|
|
99
|
+
return conn.createConfirmChannel();
|
|
100
100
|
}))().disposer((ch, promise) => delay(1000).then(() => ch.close()));
|
|
101
101
|
}
|
|
102
102
|
return bluebird_1.default.using(withDisposer(), (ch) => fn(ch));
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel, connect, Connection, Options } from 'amqplib';
|
|
1
|
+
import { Channel, ConfirmChannel, connect, Connection, Options } from 'amqplib';
|
|
2
2
|
import Bluebird from 'bluebird';
|
|
3
3
|
import { Dictionary } from 'lodash';
|
|
4
4
|
|
|
@@ -79,11 +79,11 @@ export async function withAmqpConn(fn: (conn: Connection) => Promise<any>, url:
|
|
|
79
79
|
return Bluebird.using(withDisposer(), (conn) => fn(conn));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export async function withAmqpCh(fn: (ch:
|
|
82
|
+
export async function withAmqpCh(fn: (ch: ConfirmChannel) => Promise<any>, url: string) {
|
|
83
83
|
return withAmqpConn(async conn => {
|
|
84
84
|
function withDisposer() {
|
|
85
85
|
return Bluebird.method(async () => {
|
|
86
|
-
return conn.
|
|
86
|
+
return conn.createConfirmChannel();
|
|
87
87
|
})().disposer((ch, promise) => delay(1000).then(() => ch.close()));
|
|
88
88
|
}
|
|
89
89
|
|