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

[#issue-469] -fsm-trigger depends on state consistency #471

Merged

Conversation

scgilardi
Copy link
Contributor

  • re: Reaching invalid state by dispatching continuosly #469
  • -fsm-trigger reads from and writes to volatile state
  • it works fine in cljs because that's single-threaded
  • jvm clojure interop creates a single threaded executor, but that
    coexists with the main thread for a total thread count of 2
  • adding locking on the EventQueue object avoids the race for
    clojure and is a no-op for clojurescript.

- re: day8#469
- `-fsm-trigger` reads from and writes to volatile state
- it works fine in cljs because that's single-threaded
- jvm clojure interop creates a single threaded executor, but that
  coexists with the main thread for a total thread count of 2
- adding `locking` on the `EventQueue` object avoids the race for
  clojure and is a no-op for clojurescript.
@danielcompton danielcompton merged commit e539ff6 into day8:master May 29, 2018
@danielcompton
Copy link
Contributor

Thanks heaps for this, we really appreciate it (and your previous work on re-frame 😄).

@scgilardi
Copy link
Contributor Author

You're welcome! :)

And thanks for the test!

In running the test, I did notice that it needs a bit of a tweak. The test doesn't currently wait for the processing of the events to be complete before checking that they all got processed. Maybe add a "reached the end" (sentinel) event to the queue after the test events and write some code that detects when that one is processed (maybe an event callback), or maybe just poll the db (in the test) for a count on the array until it gets to 1000 and fail if that doesn't happen in a couple of seconds. Something idiomatic and effective. As it is now, the test passes only intermittently.

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

Successfully merging this pull request may close these issues.

2 participants