buildcache icon indicating copy to clipboard operation
buildcache copied to clipboard

Do certain tasks in a background daemon process

Open mbitsnbites opened this issue 7 years ago • 1 comments

Certain tasks are better done in the background in a daemon process, such as:

  • Compress and upload cache entries to a remote cache.
  • House-keeping (prune old cache entries in the local cache).

Start a daemon process by starting the BuildCache exe with the argument --daemon, and make sure to pass the BuildCache configuration of the parent process to the child process.

One daemon is required for each unique BuildCache configuration (hash the configuration and BuildCache version?).

Start a new daemon if on isn't already running.

Let the daemon die after a time out period (e.g. 60s).

For Linux, see:

  • https://github.com/pasce/daemon-skeleton-linux-c (https://stackoverflow.com/questions/17954432/creating-a-daemon-in-linux)
  • https://www.thegeekstuff.com/2012/02/c-daemon-process/

For Windows, see:

  • https://docs.microsoft.com/en-ca/windows/win32/services/the-complete-service-sample (?)

mbitsnbites avatar Mar 31 '19 18:03 mbitsnbites

Most likely, the Windows alternative would be a service.

https://docs.microsoft.com/en-ca/windows/win32/services/the-complete-service-sample

NextDesign1 avatar Jan 28 '20 14:01 NextDesign1