* Add Job System * Remove testing stuff * changelog * plugin work * Convert a couple more jobs * simplify callback * assert * Logging changes and rendezvous perf * changelog * sb segment viewed job * clear cache, and few changes * Lint fix * a couple more jobs * reduce rendezvous in web server * refactor * Lint fix * no message * test shutdown * comment * free fields --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
32 lines
735 B
Plaintext
32 lines
735 B
Plaintext
import "pkg:/source/utils/Logging.bs"
|
|
|
|
@job("ClearCacheJob")
|
|
function ExecuteJob() as void
|
|
fs = CreateObject("roFileSystem")
|
|
if fs = invalid
|
|
JobError("Failed to create roFileSystem object")
|
|
return
|
|
end if
|
|
|
|
ClearVolume(fs, "tmp:/")
|
|
ClearVolume(fs, "cachefs:/")
|
|
end function
|
|
|
|
function ClearVolume(fs as object, volume as string)
|
|
items = fs.GetDirectoryListing(volume)
|
|
for each item in items
|
|
fullpath = volume + item
|
|
|
|
' Skip logs directory
|
|
if fullpath = "cachefs:/logs"
|
|
continue for
|
|
end if
|
|
|
|
if not fs.Delete(fullpath)
|
|
LogError("Failed to delete:", fullpath)
|
|
end if
|
|
end for
|
|
|
|
LogInfo("Cleared:", volume)
|
|
end function
|