@alizadefaig/pos-server 1.2.22 → 1.2.24
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/app/socket/server.js +5 -1
- package/package.json +1 -1
- package/utils.js +1 -9
package/app/socket/server.js
CHANGED
|
@@ -15,7 +15,10 @@ const PRINT_EVENTS = new Set(['orders.sendToWorkshops', 'orders.printBillReceip
|
|
|
15
15
|
const FISCAL_EVENTS = new Set(['fiscal.register', 'fiscal.close']);
|
|
16
16
|
function getUpstreamTimeout(event) {
|
|
17
17
|
if (FISCAL_EVENTS.has(event)) return 180000;
|
|
18
|
-
|
|
18
|
+
// В СИНХРОННОМ режиме печати этот вызов оборачивает весь круг печати на Laravel
|
|
19
|
+
// (pool 120с + Node /socket/request 90с). Должен пережить его → 150с.
|
|
20
|
+
// В АСИНХРОННОМ режиме Laravel отвечает мгновенно, запас не мешает.
|
|
21
|
+
if (PRINT_EVENTS.has(event)) return 150000;
|
|
19
22
|
return 15000;
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -39,6 +42,7 @@ module.exports = (server = null) => {
|
|
|
39
42
|
const PROXY_TARGET = getConfig().apiUrl;
|
|
40
43
|
|
|
41
44
|
socket.join(companyId);
|
|
45
|
+
if (terminalId) socket.join(`terminal:${terminalId}`);
|
|
42
46
|
socket.terminalId = terminalId;
|
|
43
47
|
socket.companyId = companyId;
|
|
44
48
|
socket.userId = userId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alizadefaig/pos-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.24",
|
|
4
4
|
"description": "Server in express js with Proxy to Main server if need and will work with Electron JS",
|
|
5
5
|
"homepage": "https://gitlab.com/faigalizade/pos-server#readme",
|
|
6
6
|
"bugs": {
|
package/utils.js
CHANGED
|
@@ -100,15 +100,7 @@ const socketSendByFilter = ({companyId, eventName, data, to, toId, excepts}, ser
|
|
|
100
100
|
if (!to) {
|
|
101
101
|
serverSocket.to(companyId).emit(eventName, data);
|
|
102
102
|
} else if (to === 'terminal' && toId) {
|
|
103
|
-
|
|
104
|
-
if (room) {
|
|
105
|
-
for (const socketId of room) {
|
|
106
|
-
const sock = serverSocket.sockets.sockets.get(socketId);
|
|
107
|
-
if (sock && sock.terminalId === toId) {
|
|
108
|
-
sock.emit(eventName, data);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
103
|
+
serverSocket.to(`terminal:${toId}`).emit(eventName, data);
|
|
112
104
|
}
|
|
113
105
|
}
|
|
114
106
|
|