If I were to write this in an operation using the EnsLib.HTTP.OutboundAdapter, my approach would be something similar to:
Set tSC = ..Adapter.SendFormData(.webresponse,"GET",webrequest)
//begin backoff algorithm
//Get start time in seconds
Set startInSeconds = $ZDTH($H,-2)
//Set initial params for algorithm
Set wait = 1, maximumBackoff=64, deadline=300
//Only run while Status Code is 504
While (webresponse.StatusCode = "504"){
//HANG for x.xx seconds
HANG wait_"."_$RANDOM(9)_$RANDOM(9)
//Call endpoint
Set tSC = ..Adapter.SendFormData(.webresponse,"GET",webrequest)
//Increment potential wait periods
If wait < maximumBackoff Set wait = wait*2
//Adjust wait if previous action takes us above the maximum backoff
If wait > maximumBackoff Set wait = maximumBackoff
//Check if deadline has been hit, exiting the While loop if we have
Set currentTimeInSeconds = $ZDTH($H,-2)
If (currentTimeInSeconds-startInSeconds>=deadline){Quit}
}This is untested however, so massive pinch of salt is required 馃槄
- Log in to post comments
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)