In _timeline_write(), limit the number of grampa levels updated.

This commit is contained in:
default 2022-11-21 08:04:22 +01:00
parent c78574c8d9
commit bf214d45e9

9
data.c
View File

@ -517,6 +517,8 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre
/* now iterate all parents up, just renaming the files */
xs *grampa = xs_dup(xs_dict_get(meta, "parent"));
int max_levels = 10;
while (!xs_is_null(grampa)) {
xs *gofn = _timeline_find_fn(snac, grampa);
@ -555,6 +557,13 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre
xs_free(grampa);
grampa = xs_dup(p);
}
else
break;
if (--max_levels == 0) {
snac_log(snac, xs_dup("_timeline_write maximum grampa levels reached"));
break;
}
}
}