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

Why does resume halt unspecified system keys? #84

Closed
dimovich opened this issue Jun 18, 2020 · 4 comments
Closed

Why does resume halt unspecified system keys? #84

dimovich opened this issue Jun 18, 2020 · 4 comments

Comments

@dimovich
Copy link

What is the best approach when suspending/resuming only changed keys, leaving untouched the other unchanged keys.

Currently resume will halt unspecified keys:
https://github.com/weavejester/integrant/blob/master/src/integrant/core.cljc#L469

Maybe I'm missing something behind the design decisions?

For the moment this is the approach that works for my use case:

(merge
 (apply dissoc system changed-keys)
 (resume config (select-keys system changed-keys) changed-keys))

Thanks!

@dimovich dimovich changed the title Why does resume halt the unspecified system keys? Why does resume halt unspecified system keys? Jun 18, 2020
@weavejester
Copy link
Owner

resume halts keys so that suspend/resume produces the same result as halt/init.

You'll need to explain why you want to partially suspend/resume.

@dimovich
Copy link
Author

I have this config:

{:proj/schedule [[1 :m some-task-fn]
                 [2 :m other-task-fn]]
 :proj/data ["some" "long" "loading" "files"]}

I update the config by changing the :proj/schedule opts:

{:proj/schedule [[1 :m some-task-fn]
                 [3 :m other-task-fn]] ;; <- changed
 :proj/data ["some" "long" "loading" "files"]}

So now I suspend and resume :proj/schedule to reflect the config changes. I don't see why :proj/data should also be restarted instead of being left as is.

I need to use resume so I can compare the new config with the running system and re-schedule only the changed tasks, while leaving the others running.

It makes sense that init will return a system with only the specified keys, but in the case of resume we are talking about a running system that could have had only some of its keys suspended.

@weavejester
Copy link
Owner

Manually choosing which keys to suspend/resume is not a use-case I want to support. It's more reliable to restart everything, and the suspend/resume system allows components with similar configurations to be reused.

@dimovich
Copy link
Author

Thank you for the comment.

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

No branches or pull requests

2 participants