Skip to content

Commit

Permalink
Merge pull request #803 from prey/fix/triggers-when-non-persisting-ac…
Browse files Browse the repository at this point in the history
…tion

Fix non persisting action triggers and same type action is already executed
  • Loading branch information
SoraKenji authored Jul 24, 2023
2 parents d0c4509 + 4a9adc2 commit aaa1786
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/agent/actions/triggers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function run_action(trigger, action) {

setTimeout(() => {
if (action.action.options) action.action.options.trigger_id = trigger.id;
commands.perform(action.action);
commands.perform(action.action, trigger.persist);
}, timeout);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/agent/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ exports.parse = function (body) {
return c;
};

exports.perform = function (command) {
exports.perform = function (command, persist = 1) {
if (!command) return handle_error(new Error('No command received'));

if (typeof command.options == 'string') {
Expand Down Expand Up @@ -212,7 +212,7 @@ exports.perform = function (command) {
}
});
}
update_stored(type, id, command.target, command.options);
if (persist) update_stored(type, id, command.target, command.options);
} else {
handle_error(
new Error('Unknown command: ' + (command.command || command.name))
Expand Down

0 comments on commit aaa1786

Please sign in to comment.