Skip to content

Commit

Permalink
Moves magic numbers to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Aug 17, 2024
1 parent 77bfe8b commit 3124df6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import (
"github.com/ksysoev/deriv-api/schema"
)

const (
// DefaultKeepAliveInterval is the default interval for sending ping requests to keep the connection alive.
keepAliveInterval = 25 * time.Second
defaultTimeout = 30 * time.Second
)

// DerivAPI is the main struct for the DerivAPI client.
type DerivAPI struct {
reqChan chan ApiReqest
Expand Down Expand Up @@ -106,10 +112,10 @@ func NewDerivAPI(endpoint string, appID int, lang string, origin string, opts ..
AppID: appID,
Lang: lang,
lastRequestID: 0,
TimeOut: 30 * time.Second,
TimeOut: defaultTimeout,
connectionLock: sync.Mutex{},
closingChan: make(chan int),
keepAliveInterval: 25 * time.Second,
keepAliveInterval: keepAliveInterval,
}

for _, opt := range opts {
Expand Down

0 comments on commit 3124df6

Please sign in to comment.