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

clip/stop runs stop functions twice #11

Closed
onetom opened this issue Jun 1, 2020 · 2 comments
Closed

clip/stop runs stop functions twice #11

onetom opened this issue Jun 1, 2020 · 2 comments

Comments

@onetom
Copy link

onetom commented Jun 1, 2020

  (def cfg {:components
            {:wheel {:start {:part "wheel"}
                     :stop  prn}}})
  (def sys (clip/start cfg))
  (clip/stop cfg sys)
=> #'repl/cfg
=> #'repl/sys
{:part "wheel"}
{:part "wheel"}
=> {:wheel nil}

and the implementation indeed seems to simply repeat the stop operation:

(defn stopping-f
  [[k {:keys [stop]}]]
  (fn [rf acc]
    (stop! (get acc k) stop)
    (-> acc
        (rf k (stop! (get acc k) stop)))))

(defn stopping-f
[[k {:keys [stop]}]]
(fn [rf acc]
(stop! (get acc k) stop)
(-> acc
(rf k (stop! (get acc k) stop)))))

@onetom
Copy link
Author

onetom commented Jun 1, 2020

Here is a temporarily workaround for the issue.
Put this into your user.clj:

(intern
  'juxt.clip.impl.core 'stopping-f
  (fn
    [[k {:keys [stop]}]]
    (fn [rf acc]
      ;(juxt.clip.impl.core/stop! (get acc k) stop)
      (-> acc
          (rf k (juxt.clip.impl.core/stop! (get acc k) stop))))))

@SevereOverfl0w
Copy link
Collaborator

You're right to post this here, I did forget :)

SevereOverfl0w added a commit that referenced this issue Aug 20, 2020
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