Skip to content

Commit

Permalink
Merge pull request #81 from nsftx/task/CU-8694vbjnw/fix_sending_async…
Browse files Browse the repository at this point in the history
…_msg_to_non_existent_frame

Send message to frameId instead slaveId
  • Loading branch information
dajanaGJ authored Jul 3, 2024
2 parents 721cd8e + 4fcb377 commit 1310a7d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/master_gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ var masterGateway = {
// Check if there is existing subscription on event(action + uuid)
if (self.isSubscribed(event.data.action)) {
resolveOrReject = function(flag, returnData){
self.sendMessage(slaveId, {

self.sendMessage(self.slaves[slaveId].frameId, {
data: returnData || { ack: true },
promiseResult: flag,
action: event.data.action + '_' + event.data.uuid,
Expand Down Expand Up @@ -360,10 +361,10 @@ var masterGateway = {
clearTimeout(rejectTimeout);
rejectTimeout = null;
if (response.promiseResult === 'resolve') {
logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise resolved for event ' + event);
logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise resolved for event ' + event);
resolve(response.data);
} else {
logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise rejected for event ' + event);
logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise rejected for event ' + event);
reject(response.data);
}

Expand All @@ -373,7 +374,7 @@ var masterGateway = {
rejectTimeout = setTimeout(function() {
subscription.remove();
reject();
logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise rejected after timeout for event ' + event);
logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise rejected after timeout for event ' + event);
}, rejectDuration);
}

Expand Down

0 comments on commit 1310a7d

Please sign in to comment.