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

Caching issues with relative time predicates #115

Open
rychipman opened this issue May 2, 2020 · 1 comment
Open

Caching issues with relative time predicates #115

rychipman opened this issue May 2, 2020 · 1 comment
Assignees
Labels

Comments

@rychipman
Copy link

Time-based predicates in org-ql interact poorly with the built-in caching behavior. Consider the predicate '(scheduled :to today). If I open up emacs and run this query (in my personal workflow, via an org-ql-view), it works just fine. However, if that emacs instance stays open until tomorrow, the query results will be stale unless something else (an edit in an agenda file, for example) invalidates the cache).

My own workflow is only minimally affected by this at the moment, since I was primarily noticing this in one of my org-ql-views. So I replaced something like this

'("Scheduled up to today"
  :title "Scheduled up to today"
  :buffers-files org-agenda-files
  :query (scheduled :to today))

with something like this

(cons "Scheduled up to today"
      (lambda ()
        (interactive)
        (org-ql-search (org-agenda-files)
          `(scheduled :to ,(format-time-string "%Y-%m-%d"))
          :title "Scheduled up to today")))

However, this does seem like a more general problem.

Some thoughts/suggestions on how this could be resolved:

  • Detect when relative time predicates' meanings have changed and invalidate the cache accordingly
  • Resolve relative time values in queries to absolute time values some time before caching (essentially a more general version of what I did above)
@alphapapa
Copy link
Owner

Thanks, that's a good point. Your second suggestion is probably the way to go.

@alphapapa alphapapa self-assigned this May 2, 2020
@alphapapa alphapapa added the bug label May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants