Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move scrape.pid to temp dir #3785

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

dszlachta
Copy link
Contributor

The motivation for this change was running scraper inside Docker, but I think it improves chifra runnig outside Docker, too.

Very, very rarely (after Ctrl-C fix) the .pid file was left after scraper had been killed. Moving the file to /tmp fixes the problem for Docker (because any directory not mounted to the host filesystem is ephemeral), but there's no guarantee that if running directly the OS will empty /tmp.

The code I added tries to use so called "variable directory" which is guaranteed to be emptied by the OS: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html

For Linux, it's /run/$UID, for Mac /usr/local/var/run. If the directory doesn't exist, we fall back to /tmp.

@dszlachta dszlachta requested a review from tjayrush June 13, 2024 11:47
@dszlachta dszlachta merged commit c3cce93 into develop Jun 13, 2024
3 checks passed
@dszlachta dszlachta deleted the feature/move_scrape.pid_to_temp_dir branch June 13, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant