nanos / FediFetcher

FediFetcher is a tool for Mastodon that automatically fetches missing replies and posts from other fediverse instances, and adds them to your own Mastodon instance.
https://blog.thms.uk/fedifetcher?utm_source=github
MIT License
309 stars 232 forks source link

Running Directly via Cron Traceback on `KNOWN_FOLLOWINGS_FILE` #6

Closed timnolte closed 1 year ago

timnolte commented 1 year ago

I'm running the get_context.py script directly via cron on my Mastodon server and the cron job is ending with the following error.

Traceback (most recent call last):
  File "/home/mastodon/get_context.py", line 668, in <module>
    with open(KNOWN_FOLLOWINGS_FILE, "w", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'artifacts/known_followings'

My cron job call is the following:

*/10 * * * * /home/mastodon/get_context.py <access-token> <domain-name> 24 20 10 <user>

From the cron output it appears that something is working.

timnolte commented 1 year ago

OK, so given that this repo isn't designed around running the script in my context, but using GitHub Actions, I realized that perhaps this was simply an issue of needing to the have the "missing" artifacts directory mentioned in the Traceback. I created that directory in the Mastodon user's home directory and things completed successfully.

timnolte commented 1 year ago

I'm curious though whether I'm going to have a problem if these files already exist since there isn't any clean-up being done under the assumption that this is being ran under an immutable environment?

nanos commented 1 year ago

Yes, correct, you got to create the artifacts directory first.

And those files need to be left in there: That's where the script stores which posts it has already fed into your instance, as well as which followings it has already backfilled.

So, don't tidy up afterwards.

Part of the complexity of running this as a GitHub Action is that we need to upload those files, after the run, and download them before the next.