Giter Club home page Giter Club logo

Comments (17)

jasonwells avatar jasonwells commented on July 4, 2024 4

@etopian I was having the same problem and switched to the following instead of Interval after digging through the code which seems to solve the issue as least for me.

    settings := goworker.WorkerSettings{
        URI:            "redis://localhost:6379/",
        Connections:    2,
        Queues:         []string{"hello"},
        UseNumber:      true,
        ExitOnComplete: false,
        Concurrency:    25,
        Namespace:      "resque:",
        IntervalFloat:  5.0,
    }

from goworker.

etopian avatar etopian commented on July 4, 2024

When I monitor redis I see this:

1471764750.337179 [0 172.17.0.1:43928] "LPOP" "resque:queue:queues"
1471764750.337349 [0 172.17.0.1:43930] "LPOP" "resque:queue:myqueue"
1471764750.337481 [0 172.17.0.1:43930] "LPOP" "resque:queue:delimited"

printed continuously and rapidly. should it not be doing this? should not setting Interval to something higher slow this process down. I have tried setting it to 5000.0 with no result.

from goworker.

etopian avatar etopian commented on July 4, 2024

Setting the commandline arg to -interval works but it does not seem to be reading the settings.

i.e.

settings := goworker.WorkerSettings{
    URI:            "redis://172.17.0.1:6379/",
    Connections:    1,
    Queues:         []string{"hello"},
    UseNumber:      true,
    ExitOnComplete: false,
    Concurrency:    1,
    Namespace:      "resque:",
    Interval:       1.0,
}    

goworker.SetSettings(settings)

from goworker.

benmanns avatar benmanns commented on July 4, 2024

Ahh, I think there's an issue with your Interval value - it's a Time.Duration, so 1.0 is actually one nanosecond. Try Interval: time.Second and see if that fixes it. I'll see if there's a way to make this less confusing.

from goworker.

etopian avatar etopian commented on July 4, 2024

Well I would expect that the command line -interval flag should work the same work as the way that WokerSettings do. so setting -interval 5.0 should be the same as setting WorkerSettings Interval to 5.0. However you decide to make this less confusing I would definitely say document it on the readme because the settings defined as an example, 5.0 nano seconds, don't really make much sense.

from goworker.

etopian avatar etopian commented on July 4, 2024

Anyhow thank you very much for writing this. It's very useful.

from goworker.

etopian avatar etopian commented on July 4, 2024

Actually even setting that to 10000000000, which is 10 seconds in nano seconds does not seem to work. So likely the problem is not just the time representation.

from goworker.

rjrobinson avatar rjrobinson commented on July 4, 2024

Hey @etopian , I've tried to recreate this, but not able too, Could you provide a repo where this happens, and I can try to re-build your steps?

from goworker.

etopian avatar etopian commented on July 4, 2024

https://github.com/etopian/goworker-example

built using go version go1.6.2 linux/amd64

from goworker.

etopian avatar etopian commented on July 4, 2024

@rjrobinson posted above.

from goworker.

rjrobinson avatar rjrobinson commented on July 4, 2024

Awesome. And the exact command line argument too please. Just so I'm covering all my bases.

from goworker.

etopian avatar etopian commented on July 4, 2024

./worker -interval 5 works fine, as does ./worker -interval 1... currently the settings interval is set to 1 which is suppose to be 1 nano second, but turning it up in the settings does not help either from my experience.

from goworker.

etopian avatar etopian commented on July 4, 2024

@jasonwells much thx

from goworker.

molizz avatar molizz commented on July 4, 2024

@jasonwells Thank you!

from goworker.

wuman avatar wuman commented on July 4, 2024

I believe that I have found the root cause to this problem. It appears that the IntervalFloat value will always override the Interval value (and by default it is 5.0). It is caused by the flags() function:

func flags() error {
    ...
    if err := workerSettings.Interval.SetFloat(workerSettings.IntervalFloat); err != nil {
        return err
    }
    ...
}

This is a good example for why issue #19 is important. Using flags to configure a library that can be used as a dependency is a bad idea.

from goworker.

etopian avatar etopian commented on July 4, 2024

@wuman Go team! Awesome!

from goworker.

benmanns avatar benmanns commented on July 4, 2024

@wuman: @FrankChung contributed #46 - do you think that will fix this issue? If so, would you mind merging it in?

from goworker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.