Skip to content

Commit

Permalink
clean cache on worker startup
Browse files Browse the repository at this point in the history
  • Loading branch information
colinthomas-z80 committed Sep 22, 2023
1 parent deb2529 commit e6b4fd6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions taskvine/src/worker/vine_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ void vine_cache_load(struct vine_cache *c)
if (!strcmp(d->d_name, ".."))
continue;

debug(D_VINE, "found %s in cache", d->d_name);
if (strstr(d->d_name, "-meta-") || strstr(d->d_name, "-rnd-")) {
char *filepath = string_format("cache/%s", d->d_name);
debug(D_VINE, "found non-workflow cache %s, trashing file", d->d_name);
trash_file(filepath);
free(filepath);
} else {
debug(D_VINE, "found %s in cache", d->d_name);
}

struct stat info;
int64_t nbytes, nfiles;
Expand Down Expand Up @@ -183,7 +190,7 @@ void vine_cache_delete(struct vine_cache *c)
{
if (strstr(cachename, "-meta-") || strstr(cachename, "-rnd-")) {
char *filepath = string_format("cache/%s", cachename);
unlink(filepath);
trash_file(filepath);
free(filepath);
}
vine_cache_kill(c, file, cachename, 0);
Expand Down

0 comments on commit e6b4fd6

Please sign in to comment.