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

Feature request: equalp keys for cron jobs #4

Open
fstamour opened this issue Nov 6, 2023 · 3 comments
Open

Feature request: equalp keys for cron jobs #4

fstamour opened this issue Nov 6, 2023 · 3 comments

Comments

@fstamour
Copy link

fstamour commented Nov 6, 2023

I just came up with a situation where I'd like to add a bunch of jobs, something like this:

  • update from server 1
  • update from server 2
  • update from server 3

So it could've been nice to use lists as hash-keys, something like that:

(mapcar (lambda (server)
          (cl-cron:make-cron-job
           (lambda () (update server))
           :hash-key '(update server)))
        '(1 2 3))

Would that make sense?

From what I saw, that key is only used when removing the jobs.


In the meantime, I'll hack something with symbolicate :P

@vindarel
Copy link
Contributor

vindarel commented Nov 7, 2023

Can you not simply format a string for this identifier?

@fstamour
Copy link
Author

fstamour commented Nov 7, 2023

Can you not simply format a string for this identifier?

That would also require :test 'equal.

https://stackoverflow.com/a/1409102

@vindarel
Copy link
Contributor

vindarel commented Nov 8, 2023

(defvar *cron-jobs-hash* (make-hash-table)
  "contains a hash of all cron-job objects that need to be run")

…
  (setf (gethash hash-key *cron-jobs-hash*)
	(make-instance 'cron-job 

oh so yes, an equal or equalp test seems legitimate.

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

No branches or pull requests

2 participants