liebke / avout Goto Github PK
View Code? Open in Web Editor NEWAvout: Distributed State in Clojure
Avout: Distributed State in Clojure
(let [test-ref (avout/zk-ref *avout-client* "some-key")]
(add-watch test-ref "some-key" (fn [& args] true))
(remove-watch test-ref "some-key"))
java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
at clojure.core$swap_BANG_.invoke (core.clj:2160)
avout.refs.DistributedReference.removeWatch (refs.clj:106)
clojure.core$remove_watch.invoke (core.clj:1975)
Because alter!! and set-ref!! fail (with "Must run alter!! within the dosync!! macro") when transaction state is anything other than RUNNING, transactions in RETRY state always fail.
I have created a zk-ref and added two watchers. One is added inline at created of the ref, the other is added subsequently using add-watch.
I then run tests by manually (from the REPL) changing the zk-ref from a remote machine.
Occasionally, I notice both watchers are called with the PREVIOUS state in the new (last) argument. Immediately after this problem, I verify that the distributed ref has the correct value on the same machine where the watcher was invoked incorrectly.
set-to/watcher-called-with/zk-ref-has
1/1/1
2/2/2
3/2/3
about.io is down at the time of writing this.
The website appears to be broken. All I get is a blank page. The root cause appears to be that avout.io creates a frameset referencing https://leibke.github.io/avout/, which is itself a permanent redirect back to avoit.io.
Any chance this could be fixed?
Hi,
If for whatever reason the ZK client drops a connnection and reconnects before the SESSION_EXPIRY is raised, the number of watchers managed by the client will double each time.
During some network issues we had a few processes grind down to a halt because of this.
This is because Avout raises a watcher to manage the internal state of atoms and refs. I.e. see invalidateCache in avout.refs.
What should happen here is that each time the watcher is triggered, it should filter out events like {:event-type :None, :keeper-state :Disconnected}, perhaps by only ever being interested in event-type NodeDataChanged.
When these events get raised Avout currently registers brand new watchers even though the original watcher will still carry on firing. In ZK watchers are "fire-once" but not in the case of some events like the disconnect/connect.
This is the same for addWatch in refs and atoms.
I'm wondering also if there is a real use case project list that are using this library or perhaps it's advisable to take a look at other alternatives more actively maintained
Thanks in advance
Modeling Clojure's STM, a user can reasonably expect an exception thrown within a dosync!! block to abort the transaction without side-effects.
This is not in fact the case.
=> (seq @(.state (avout.transaction/get-local-transaction
*avout-client*)))
(0 0 0 0 0 0 0 0)
=> (avout/dosync!! *avout-client*
(throw (RuntimeException. "FAIL!")))
run-in-transaction exception: #<RuntimeException java.lang.RuntimeException: FAIL!>
nil
=> (seq @(.state (avout.transaction/get-local-transaction
*avout-client*)))
(0 0 0 0 0 0 0 2)
I have noted that zk-atoms do not persist when the client connection is broken. More details when available.
There are two expression like the one below in files atoms.clj and refs.clj that appear incorrect:
(removeWatch [this key](swap! watches %28dissoc key%29) this)
I believe the parens around (dissoc key) should be removed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.