timeoutopencpu

Can the timeout for the temporary file created by opencpu be extended?


I have several functions that return a graph or a table in an image format. After they are created I've referred to them using the link. The problem is that some times I send those links to third party, and by the time they read them the link is already expired, so there is no "image" attached. Can the expiry period of the temporary file be extended through any type of configuration ?


Solution

  • Yes! The cleanup script that deletes the temp files is triggered in /etc/cron.d/opencpu. It has a shell script that looks like this:

    #This removes entries from the "temporary library" over a day old.
    if [ -d "/tmp/ocpu-store" ]; then
        find /tmp/ocpu-store/ -mindepth 1 -mmin +1440 -user www-data -delete || true
        find /tmp/ocpu-store/ -mindepth 1 -mmin +1440 -user www-data -type d -empty -exec rmdir {} \; || true
    fi
    

    So you can either modify the 1440 to a higher value, or change the cron line to run less frequently.