Command retries

Is there a way currently to set up a command so that it will have a number of retry attempts before actually being marked as failed?

I am thinking about implementing something like that but didn't know if someone else might have already written a plugin or not.

map.mapCommand().toCommand().maxRetries();

  1. Hi :)

    I'm not sure I understand what you want to achieve, but maybe guards and hooks are the answer to your problem. Have you tried to use them already?

    Command mapping with guards and hooks:

    https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...

    Guards:

    https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...

    Hooks:

    https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...

    There are also a few discussion about guards and hooks.

    The macrobot utility is also interesting:
    https://github.com/alebianco/robotlegs-utilities-macrobot

    I am thinking about implementing something like that but didn't know if someone else might have already written a plugin or not.

    Not to my knowledge.

    Ondina

  2. Yes I have, so what I am doing is using the macro utilties plugin to run a sequence macro that consists of three commands

    prepare()
    {
        add(CommandOne);
        add(CommandTwo);
        add(CommandThree);
    }
    

    I want the macro to succeed only if all three commands succeed. Each command is an AsyncCommand. Now, what I want to do is if let's say CommandTwo fails (maybe it can't retrieve data from the server) then I'd like it to retry CommandTwo up to X amount of times before it says the macro command fails or succeeds. I know I can control this within CommandTwo by writring my own code to retry it and only dispatchComplete() when I want, but I didn't know if there was an automated way already set upo so that I could write something like

    prepare()
    {
        add(CommandOne);
        add(CommandTwo).maxRetries(3);
        add(CommandThree);
    }
    

    So that CommandTwo will be retried in the robotlegs2 framework automatically without me writing that code.

    Does that make sense?

  3. Yes, I understand now.

    Robotlegs can't do it automatically.

    I think, what you want is to perform the action inside of a command n times, not to trigger the command itself n times, right?
    Make a base command having the retry logic and extend it wherever you need.

  4. Correct, that's what I'm currently doing. But was thinking about trying to modify the framework to allow for it automatically if possible. But either way, question answered! Thanks

  5. You're welcome!

  6. Ondina D.F. closed this discussion on 12 Nov, 2016 03:22 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac