Skip to content

Commit e85be5e

Browse files
authored
add support for optionally stalling/choking the ItemsCursor calling go-routine on each call to get-items request (#130)
1 parent 54dfe2a commit e85be5e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/dataplane/itemscursor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package v3io
22

3+
import "time"
4+
35
type ItemsCursor struct {
46
currentItem Item
57
currentError error
@@ -75,6 +77,10 @@ func (ic *ItemsCursor) NextItemSync() (Item, error) {
7577
// get the previous request input and modify it with the marker
7678
ic.getItemsInput.Marker = ic.nextMarker
7779

80+
if ic.getItemsInput.ChokeGetItemsMS != 0 {
81+
time.Sleep(time.Duration(ic.getItemsInput.ChokeGetItemsMS) * time.Millisecond)
82+
}
83+
7884
// invoke get items
7985
newResponse, err := ic.container.GetItemsSync(ic.getItemsInput)
8086
if err != nil {

pkg/dataplane/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ type GetItemsInput struct {
297297
ReturnData string
298298
DataMaxSize int
299299
RequestJSONResponse bool `json:"RequestJsonResponse"`
300+
ChokeGetItemsMS int
300301
}
301302

302303
type GetItemsOutput struct {

0 commit comments

Comments
 (0)