add: macro endpoints
add: basic macro support fix: database locking with lock-pointer fix: memory leaks
This commit is contained in:
parent
6a2b94ef1c
commit
9d2c48d645
30 changed files with 606 additions and 213 deletions
src
17
src/cache.c
17
src/cache.c
|
@ -1,6 +1,7 @@
|
|||
#include <cache.h>
|
||||
#include <logger.h>
|
||||
#include <sql/cache.h>
|
||||
#include <models/macro_action.h>
|
||||
#include <models/junction_tag.h>
|
||||
#include <models/junction_relay_schedule.h>
|
||||
|
||||
|
@ -136,13 +137,18 @@ cache_invalidate_schedule(int schedule_id)
|
|||
cache_invalidate(key);
|
||||
|
||||
int *relay_ids = junction_relay_schedule_get_relay_ids_with_schedule(schedule_id);
|
||||
|
||||
for(int i = 0; relay_ids[i] != 0; ++i)
|
||||
{
|
||||
cache_invalidate_relay(relay_ids[i], -1);
|
||||
}
|
||||
|
||||
free(relay_ids);
|
||||
|
||||
int *macro_ids = macro_action_get_macro_ids_with_schedule(schedule_id);
|
||||
for(int i = 0; macro_ids[i] != 0; ++i)
|
||||
{
|
||||
cache_invalidate_macro(macro_ids[i]);
|
||||
}
|
||||
free(macro_ids);
|
||||
}
|
||||
|
||||
|
||||
|
@ -181,6 +187,13 @@ cache_invalidate_relay(int relay_id, int status_relay)
|
|||
{
|
||||
cache_invalidate_controller(controller_id);
|
||||
}
|
||||
|
||||
int *macro_ids = macro_action_get_macro_ids_with_relay(relay_id);
|
||||
for(int i = 0; macro_ids[i] != 0; ++i)
|
||||
{
|
||||
cache_invalidate_macro(macro_ids[i]);
|
||||
}
|
||||
free(macro_ids);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue