Good morning,
I am using a REST API with a system for customer communication.
Sometimes I get an error '500' as response status code.
So I want to try an exponential backoff and repeat sending the request for a few times with longer intervals.
At the moment the Pause/ Delay action just allows me to enter a delay in milliseconds, seconds, minutes.
I can not enter a variable value that increases with my value.
Do I have another chance to create a delay in the task with a variable value?
Pause/ Delay with variable value
Re: Pause/ Delay with variable value
You can use Simple loop. Look at my example belowDo I have another chance to create a delay in the task with a variable value?
Set necessary pause in seconds in the 1-st step
I think the algorithm is clear
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1453"
Hide=INTEGER|0
ID=INTEGER|-648954384
LogOnAsUser=INTEGER|1
Name=STRING|"Custom pause"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""pause"" with value ""5"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"pause"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"pause"
varvalue=STRING|"5"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""dt"" with value ""{DateTime}"""
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"dt"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"dt"
varvalue=STRING|"{DateTime}"
[Actions\Action3]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER
[Actions\Action3\Params]
begin=STRING|"1"
end=STRING|"{pause}"
step=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1 sec"
Params=FOLDER
[Actions\Action4\Params]
delay=STRING|"1"
dimension=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action6]
ActionID=STRING|"A_TIMEDIFFERENCE"
Enabled=INTEGER|-1
Name=STRING|"Time Difference"
Params=FOLDER
[Actions\Action6\Params]
_rt_variables_produced=STRING|"delay"
datetime1=STRING|"{dt}"
datetime2=STRING|"{DateTime}"
format=STRING|"0"
valuekind=STRING|"0"
varname=STRING|"delay"
[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Delay is {delay} seconds"""
Params=FOLDER
[Actions\Action7\Params]
icon=STRING|"1"
msg0=STRING|"Delay is {delay} seconds"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Re: Pause/ Delay with variable value
Hi,
thanks for the quick response.
I could already find another way to solve the problem.
I used the following process:
thanks for the quick response.
I could already find another way to solve the problem.
I used the following process:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1199727700
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1453"
Hide=INTEGER|0
ID=INTEGER|-648954384
LogOnAsUser=INTEGER|1
Name=STRING|"Custom pause"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""counter"" with value ""1"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"counter"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"counter"
varvalue=STRING|"1"
[Actions\Action10]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""pause"" with value ""5"""
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"pause"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"pause"
varvalue=STRING|"5"
[Actions\Action3]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER
[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"5"
type=STRING|"1"
value1=STRING|"{counter}"
value2=STRING|"4"
[Actions\Action4]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER
[Actions\Action4\Params]
begin=STRING|"1"
end=STRING|"{pause}"
step=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1 sec"
Params=FOLDER
[Actions\Action5\Params]
delay=STRING|"1"
dimension=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action7]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""counter"""
Params=FOLDER
[Actions\Action7\Params]
incement=STRING|"1"
vaiable=STRING|"counter"
[Actions\Action8]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""pause"""
Params=FOLDER
[Actions\Action8\Params]
incement=STRING|"5"
vaiable=STRING|"pause"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"{counter} - {pause} sec"
type=STRING|"3"
Re: Pause/ Delay with variable value
By the way, starting from version 6.8, the Pause action allows you to use variables in the pause field
Take a look at the example below
Take a look at the example below
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1897123812
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1478"
Hide=INTEGER|0
ID=INTEGER|493413889
LogOnAsUser=INTEGER|1
Name=STRING|"Pause with variables"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
[Actions\Action1]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER
[Actions\Action1\Params]
begin=STRING|"1"
end=STRING|"5"
step=STRING|"1"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""p"" with value ""{RandomValue(5)}"""
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"p"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"p"
varvalue=STRING|"{RandomValue(5)}"
[Actions\Action3]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action3\Params]
message=STRING|"{p}"
type=STRING|"3"
[Actions\Action4]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay {p} sec"
Params=FOLDER
[Actions\Action4\Params]
delay=STRING|"{p}"
dimension=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov