Skip to content

Commit

Permalink
elevator timeout example
Browse files Browse the repository at this point in the history
  • Loading branch information
yahya077 authored and yahya.hindioglu committed Mar 3, 2024
1 parent f53a716 commit 1fd29be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions elevator/elevator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"gopkg.in/yaml.v3"
"os"
"sync"
"time"
)

func readYml(path string) ([]byte, error) {
Expand Down Expand Up @@ -115,6 +116,7 @@ func (e *ElevatorEngine) WarmUp() IElevatorEngine {
c, err := room.NewConnection(
room.WithBaseUrl(r.Connection.BaseURL),
room.WithDefaultHeader(room.NewHeader(room.NewMapStore(r.Connection.Headers))),
room.WithTimeout(time.Duration(r.Connection.Timeout)*time.Second),
)

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions examples/yml_concurrent_example/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ flat:
todo1Room:
connection:
baseUrl: ${BASE_URL}
timeout: 15
timeout: 1 # this request will timeout
headers:
Content-Type: "application/json"
X-Type: "TODO - 2"
requests:
addTodo:
concurrentKey: "add"
method: "POST"
path: "todos/add"
path: "todos/add?delay=3000"
todo2Room:
connection:
baseUrl: ${BASE_URL}
Expand Down
3 changes: 3 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ func (r *BaseRequest) PreRequest() IRequest {

func (r *BaseRequest) SetConnectionConfig(connectionConfig IConnectionConfig) IRequest {
r.connectionConfig = connectionConfig

//TODO make an observer for changes of few fields
r.contextBuilder = NewContextBuilder(r.connectionConfig.TimeoutDuration())
return r
}

Expand Down

0 comments on commit 1fd29be

Please sign in to comment.