MCPcopy
hub / github.com/locustio/locust / between

Function between

locust/user/wait_time.py:10–20  ·  view source on GitHub ↗

Returns a function that will return a random number between min_wait and max_wait. Example:: class MyUser(User): # wait between 3.0 and 10.5 seconds after each task wait_time = between(3.0, 10.5)

(min_wait: float, max_wait: float)

Source from the content-addressed store, hash-verified

8
9
10def between(min_wait: float, max_wait: float) -> Callable[["User"], float]:
11 """
12 Returns a function that will return a random number between min_wait and max_wait.
13
14 Example::
15
16 class MyUser(User):
17 # wait between 3.0 and 10.5 seconds after each task
18 wait_time = between(3.0, 10.5)
19 """
20 return lambda instance: min_wait + random.random() * (max_wait - min_wait)
21
22
23def constant(wait_time: float) -> Callable[["User"], float]:

Callers 15

MyUserClass · 0.90
TaskSet2Class · 0.90
WebsiteUserClass · 0.90
WebsiteUserClass · 0.90
WebsiteUserClass · 0.90
WebsiteUserClass · 0.90
WebsiteUserClass · 0.90
AwesomeUserClass · 0.90
WebsiteUserClass · 0.90
WebsiteUserClass · 0.90
AwesomeUserClass · 0.90
UserClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…