@xuda.io/account_module 1.2.2014 → 1.2.2016

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.
Files changed (2) hide show
  1. package/index_ms.mjs +17 -10
  2. package/package.json +1 -1
package/index_ms.mjs CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  import amqplib from 'amqplib';
7
7
 
8
+ let queue={}
9
+
8
10
  // --- AMQP Connection & Channel ---
9
11
  const conn = await amqplib.connect('amqp://localhost');
10
12
  const channel = await conn.createChannel();
@@ -33,16 +35,21 @@ import amqplib from 'amqplib';
33
35
 
34
36
  const send_to_queue =async function(ms_method, ...args) {
35
37
 
36
- global[`_${global.module_in}_ch`].sendToQueue(
37
- 'account_module',
38
- Buffer.from(
39
- JSON.stringify({
40
- ms_method,
41
- data: args,
42
- cb:`_account_module-${global.module_in}_ch`
43
- })
44
- )
45
- );
38
+ const queue_id=Date.now()
39
+ queue[queue_id]= new Promise(()=>{
40
+
41
+ global[`_${global.module_in}_ch`].sendToQueue(
42
+ 'account_module',
43
+ Buffer.from(
44
+ JSON.stringify({
45
+ ms_method,
46
+ data: args,
47
+ cb:`_account_module-${global.module_in}_ch`
48
+ })
49
+ )
50
+ );
51
+
52
+ })
46
53
  };
47
54
 
48
55
  // You must define this somewhere before using these wrappers:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2014",
3
+ "version": "1.2.2016",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {