Island: Fix agent stopping bugs

2 bugs fixed: UI used miliseconds instead of seconds and island kept stopping monkeys, but it should only stop monkey once to not prevent more runs
This commit is contained in:
vakaris_zilius 2022-03-16 16:00:58 +00:00 committed by Mike Salvatore
parent 1c79efc941
commit 1d74864092
2 changed files with 9 additions and 3 deletions

View File

@ -29,7 +29,12 @@ def should_agent_die(guid: int) -> bool:
def _should_agent_stop(monkey: Monkey) -> bool:
return monkey.config.should_stop
if monkey.config.should_stop:
# Only stop the agent once, to allow further runs on that machine
monkey.config.should_stop = False
monkey.save()
return True
return False
def _is_monkey_killed_manually(monkey: Monkey) -> bool:

View File

@ -88,10 +88,11 @@ class MapPageComponent extends AuthComponent {
{
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({kill_time: Date.now()})
// Python uses seconds, Date.now uses milliseconds, so convert
body: JSON.stringify({kill_time: Date.now() / 1000})
})
.then(res => res.json())
.then(res => {this.setState({killPressed: true}); console.log(res)});
.then(res => {this.setState({killPressed: true})});
};
renderKillDialogModal = () => {