This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-05
Channels
- # beginners (45)
- # boot (2)
- # cider (2)
- # cljs-experience (1)
- # cljsrn (6)
- # clojure (67)
- # clojure-brasil (1)
- # clojure-dusseldorf (47)
- # clojure-finland (7)
- # clojure-italy (81)
- # clojure-portugal (2)
- # clojure-russia (12)
- # clojure-sanfrancisco (1)
- # clojure-serbia (1)
- # clojure-spec (22)
- # clojure-uk (27)
- # clojurescript (49)
- # clojurewerkz (3)
- # code-reviews (3)
- # component (19)
- # core-async (3)
- # cursive (16)
- # events (7)
- # fulcro (20)
- # graphql (7)
- # immutant (1)
- # jobs (2)
- # juxt (44)
- # leiningen (7)
- # lumo (35)
- # onyx (31)
- # portkey (31)
- # portland-or (8)
- # random (1)
- # re-frame (82)
- # reagent (35)
- # sfcljs (1)
- # spacemacs (5)
- # specter (7)
- # unrepl (4)
- # yada (2)
Hi everyone
I'm trying to write a input plugin and for the moment it's working but the poll! Function seems to be called very very frequently like many times per second
So is there a way to configure the frequency of the calls to poll!
Or am I doing something wrong in the poll! Function like returning a wrong value resulting in unnecessary polling ?
Thank you
@dwarfylenain yeah this is by design, what you can do is simply invoke a Thread/sleep command inside the poll! function as long as it is not longer than timeout-ms
(last argument passed to the poll!
function)
Ok I see
Thank you I will try that
i think this is the place where this poll! is invoked: https://github.com/onyx-platform/onyx/blob/0.10.x/src/onyx/peer/read_batch.clj#L39
I mean in this case it doesn't really matter to me because I'm receiving the input data as a stream so it doesn't "cost" me much to poll and see if there is new data in my buffer
But my next input plugin will actually call a rest API where there is rate limiting so
Yo but the sleep thing should work for me
@dwarfylenain i think the best thing to do is keep track of the rate limiting inside your poll! function, but just return nil when you're currently rate limited
when you're blocking inside the poll! function for too long, bad things could happen (since you're also blocking other lifecycle activities)
Oki I see, it makes sense, thank you
Just a last question
The timeout you are talking about is the value you provide in your catalog in :onyx/batch-timeout
Or it has nothing to do with it ?
https://github.com/onyx-platform/onyx/blob/0.10.x/src/onyx/peer/task_lifecycle.clj#L576
Ok, great ๐
I digged into the docs but not really into the code itself
Ok so I just return nil except if I know I can make a โnewโ call the API for fresh data (like I counted that since last call enough time has passed)