GithubHelp home page GithubHelp logo

backoff's People

Contributors

evanmcc avatar ferd avatar fishcakez avatar getong avatar kanatohodets avatar msch avatar paulo-ferraz-oliveira avatar rpt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backoff's Issues

deprecation warning

When trying to compile backoff 1.1.5 I get these warnings:

 → DEBUG=1 rebar3 compile
===> Load global config file /Users/benoitc/.config/rebar3/rebar.config
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {default,install_deps},
                                                  {default,lock},
                                                  {default,compile}]
===> Provider: {default,app_discovery}
===> Provider: {default,install_deps}
===> Verifying dependencies...
===> Provider: {default,lock}
===> Provider: {default,compile}
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, compile) -> no hooks defined

===> Compiling backoff
===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, compile) -> no hooks defined

===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info,{d,'OLD_RANDOM'}]
===> files to compile ["/Users/benoitc/BarrelProject/backoff/_build/default/lib/backoff/src/backoff.erl"]
src/backoff.erl:45: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:62: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:134: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
src/backoff.erl:134: Warning: random:seed/1: the 'random' module is deprecated; use the 'rand' module instead
src/backoff.erl:135: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
src/backoff.erl:135: Warning: random:seed/1: the 'random' module is deprecated; use the 'rand' module instead

===>      Compiled backoff.erl
===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("/Users/benoitc/BarrelProject/backoff", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, app_compile) -> no hooks defined

===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, compile) -> no hooks defined

===> run_hooks("/Users/benoitc/BarrelProject/backoff", post_hooks, compile) -> no hooks defined

I am using latest version of erlang 20.3.4:

→ erl
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.3  (abort with ^G)

Fail returning incremented delay

Hi, why is backoff:fail/1 returning {NewDelay, _} and not {OldDelay, _}? For me it would make more sense to return the current value and the updated backoff record with new value.

Thanks.

remove the `proper` plugins from the build

Each time I am trying to test my own code and fetch the backoff dependency it tries to compile proper which create 2 issues imo:

  1. we have to fetch an unwanted dep
  2. it triggers some warning:
/_build/default/plugins/proper/src/proper_typeserver.erl:553: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:556: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:553: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)
_build/default/plugins/proper/src/proper_typeserver.erl:556: Warning: erlang:get_stacktrace/0 used following a 'try' expression may stop working in a future release. (Use it inside 'try'.)

Woiuld it be possible to have this plugin only set by the users in its own config file? For the second maybe also a newer version of proper is existing?

Jitter algorithm not random once at maxium delay

Once the maximum delay is reached using the jitter type the delay is always the maximum. This leads to convergence if multiple processes using backoff delay communicate with a bottleneck. Once one processes gets queued behind another at the bottleneck they remain in sync for the next (maximum) backoff delay (and all future maximum delays). Because the grouping remains for future delays the effect snowballs and more processes join the batch leading to a thundering herd.

Obviously the same effect could occur with the normal type but the jitter algorithm should produce random delays to avoid this.

Does not compile with latest rebar

Using a fresh clone of this repo:

$ rebar --version
rebar 2.6.4 19 20161104_120301 No VCS info available.
$ rebar get-deps compile
Uncaught error in rebar_core: {'EXIT',
                               {function_clause,
                                [{code,which,
                                  [{rebar3_proper,"0.5.0"}],
                                  [{file,"code.erl"},{line,719}]},
                                 {rebar_core,'-plugin_modules/3-lc$^0/1-0-',
                                  1,
                                  [{file,"src/rebar_core.erl"},{line,573}]},
                                 {rebar_core,plugin_modules,3,
                                  [{file,"src/rebar_core.erl"},{line,573}]},
                                 {rebar_core,process_dir1,7,
                                  [{file,"src/rebar_core.erl"},{line,244}]},
                                 {rebar_core,process_commands,2,
                                  [{file,"src/rebar_core.erl"},{line,93}]},
                                 {rebar,main,1,
                                  [{file,"src/rebar.erl"},{line,58}]},
                                 {escript,run,2,
                                  [{file,"escript.erl"},{line,757}]},
                                 {escript,start,1,
                                  [{file,"escript.erl"},{line,277}]}]}}

Same results with either OTP 18.0 or 19.2.

Add API `backoff:exp/1`/`backoff:exp/2`

In my usage I count the number of retries R. I want to process an exponential backoff delay directly from this number R.

Why not offer an API such as:

1> backoff:increment(1).
2
2> backoff:increment(2).
4
3> backoff:increment(3).
8

This is the same as doing the recursive calls, but is more direct to use when working with a state tracking the number of retries.

The same with the jitter API: backop:exp_rand/1 and backop:exp_rand/2.

I could do a PR if this makes sense.

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.