Skip to content

Commit 5cb6810

Browse files
committed
fix(connection): add max requests configuration for testing endpoints
1 parent f65c277 commit 5cb6810

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

core/dbio/connection/connection_discover.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ func (c *Connection) Test() (ok bool, err error) {
8585
g.Debug(env.MagentaString(g.F("testing endpoints with a record limit: %d. Set env var SLING_TEST_ENDPOINT_LIMIT to modify.", limit)))
8686
}
8787

88+
maxRequests := cast.ToInt(g.Getenv("SLING_TEST_ENDPOINT_MAX_REQUESTS", "2"))
89+
if maxRequests == 0 {
90+
maxRequests = 3
91+
}
92+
93+
apiClient.Context.Map.Set("max_requests", maxRequests)
94+
if g.Getenv("SLING_TEST_ENDPOINT_MAX_REQUESTS") == "" {
95+
g.Debug(env.MagentaString(g.F("testing endpoints with a max requests: %d. Set env var SLING_TEST_ENDPOINT_MAX_REQUESTS to modify.", maxRequests)))
96+
}
97+
8898
for _, endpoint := range endpoints {
8999
// check for match to test (if provided)
90100
allowTest := len(testEndpoints) == 0

0 commit comments

Comments
 (0)