The update_remote_destroy/1 does not destroy the pengine that is referenced in the Event-argument. This results in odd behaviour of "pengine does not exist"-exceptions, because sometimes a wrong pengine gets destroyed, because currently the first pengine that is found from database gets destroyed.
Code below has two pengine_create/1's. When the first finishes it's query before the second, it destroys the second because the pengines are asserted with asserta
pengine_create([server('http://localhost:4000')]),pengine_create([server('http://localhost:5000')]),pengine_event_loop(pengine_stuff:eventx,[]).
Current code. It should be changed so that it gets the Id-term from the Event-term.
update_remote_destroy(Event) :-pengine_remote(Id, _Server),destroy_event(Event), !,pengine_unregister_remote(Id).update_remote_destroy(_).
And the current test_pengines.pl has code where both pengines finish at the same time, because both pengines have exactly the same predicates, so none of them finish earlier than the other
The update_remote_destroy/1 does not destroy the pengine that is referenced in the Event-argument. This results in odd behaviour of "pengine does not exist"-exceptions, because sometimes a wrong pengine gets destroyed, because currently the first pengine that is found from database gets destroyed.
Code below has two pengine_create/1's. When the first finishes it's query before the second, it destroys the second because the pengines are asserted with asserta
pengine_create([server('http://localhost:4000')]),pengine_create([server('http://localhost:5000')]),pengine_event_loop(pengine_stuff:eventx,[]).
Current code. It should be changed so that it gets the Id-term from the Event-term.
update_remote_destroy(Event) :-
pengine_remote(Id, _Server),
destroy_event(Event), !,
pengine_unregister_remote(Id).
update_remote_destroy(_).
And the current test_pengines.pl has code where both pengines finish at the same time, because both pengines have exactly the same predicates, so none of them finish earlier than the other