Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non persisting action triggers and same type action is already executed #803

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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