Skip to content

Commit

Permalink
updated the release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Jul 29, 2022
1 parent 5217407 commit 2b87a82
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions integration/test/performancetest/transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,25 +342,13 @@ Param: commit hash in terms of string
*/
func (transmitter * TransmitterAPI) UpdateReleaseTag(hash string) error{
var err error
var ae *types.ConditionalCheckFailedException
packet := make(map[string]interface{})
packet[HASH] = hash
packet[IS_RELEASE] = true
for attemptCount:=0; attemptCount< MAX_ATTEMPTS; attemptCount++ {//concurrency retry
/*solving parallel updates using an optimistic lock and retry,
this may result in a livelock;
however, random sleeps makes this possiblity nearly impossible*/
err = transmitter.UpdateItem(packet) //try to update the item
//this may be overwritten by other test threads, in that case it will return a specific error
if errors.As(err,&ae){ //check if our call got overwritten
// item has changed
fmt.Println("Retrying...")
rand.Seed(time.Now().UnixNano())
time.Sleep(time.Duration(rand.Intn(UPDATE_DELAY_THRESHOLD))*time.Second)
continue
}
fmt.Println("Update Completed")
break
err = transmitter.UpdateItem(packet) //try to update the item
//this may be overwritten by other test threads, in that case it will return a specific error
if err !=nil{
return err
}
return err
}
Expand Down

0 comments on commit 2b87a82

Please sign in to comment.