Skip to content

Auto fetching #23

Description

@strboul
  • Asynchronous fetching operation: fetching should be as fast as possible. (Need to resolve Use more async operations #22)

  • If fetching isn't fast enough, do it in the background in a forked process invoked when the command is called.

  • The time is Realtime Timer, not Monotonic, (borrowing here the nomenclature of systemd-timer), so the time is always ticking even when the machine is powered off.

Need to check the date and internal storage that auto-fetch has been done. For internal storage, maybe choose a path like ~/.config/git-substatus/state.json.

# state.json file (mirroring the data structure of config.json)
{
  "autoFetchHooks": [
    {
      "folders": ["/path/to/folder1", "path/to/folder2"],
      "lastRunDate": "2023-01-...", # last command run with autofetchhooks modified.
    }
  ]
}

Pseudocode.

if config.autoFetchHooks.minutes:
  if (now() > state.autoFetchHooks.lastRunDate
      and now + config.autofetchHooks.minutes > state.autoFetchHooks.lastRunDate):
    args.append('--fetch')
 

Create a config entry. (Need to resolve #7)

autoFetchHooks:
    minutes: 60 # after login, after every x minutes, command will be run with the `--fetch` flag. Only positive integers are allowed. Minimum value is `1`.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions