Skip to content

Commit 3dcbafa

Browse files
committed
Dont wait after making the last request
1 parent 8565140 commit 3dcbafa

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

.github/workflows/run_notify_load.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ on:
1515
description: 'The duration of the main test'
1616
required: true
1717
default: '900'
18-
rampUpDuration:
19-
description: 'The duration to ramp up to the arrival rate'
20-
required: true
21-
default: '900'
2218
maxVusers:
2319
description: 'Maximum number of vusers to create'
2420
required: true
25-
default: '10000'
21+
default: '1000'
2622

2723
jobs:
2824
run_artillery:
@@ -38,7 +34,6 @@ jobs:
3834
echo "## environment : ${{ github.event.inputs.environment }}" >> "$GITHUB_STEP_SUMMARY"
3935
echo "## arrivalRate : ${{ github.event.inputs.arrivalRate }}" >> "$GITHUB_STEP_SUMMARY"
4036
echo "## duration : ${{ github.event.inputs.duration }}" >> "$GITHUB_STEP_SUMMARY"
41-
echo "## rampUpDuration : ${{ github.event.inputs.rampUpDuration }}" >> "$GITHUB_STEP_SUMMARY"
4237
echo "## maxVusers : ${{ github.event.inputs.maxVusers }}" >> "$GITHUB_STEP_SUMMARY"
4338
4439
- name: Checkout repo

artillery/notify_entrypoint.mjs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export function initUser(context, events, done) {
7070
let prescriptionCount = Math.round(sampleNormal(3,1))
7171
if (prescriptionCount < 1) prescriptionCount = 1 // just truncate at 1.
7272
context.vars.prescriptionCount = prescriptionCount
73+
context.vars.loopcount = 0
7374

7475
logger.info(`Patient ${context.vars.nhsNumber}, ODS ${context.vars.odsCode} has ${context.vars.prescriptionCount} prescriptions`)
7576

@@ -90,12 +91,20 @@ export function generatePrescData(requestParams, context, ee, next) {
9091
requestParams.json = body
9192
context.vars.x_request_id = uuidv4()
9293
context.vars.x_correlation_id = uuidv4()
94+
95+
context.vars.loopcount += 1
9396

9497
// Wait this long between requests
95-
let delay = sampleNormal(60, 60)
96-
while (delay < 0) delay = sampleNormal(60, 60)
98+
let meanDelay = 10 // seconds
99+
let stdDevDelay = 10 // seconds
100+
let delay = 0
101+
if (context.vars.loopcount < context.vars.prescriptionCount) {
102+
delay = sampleNormal(meanDelay, stdDevDelay)
103+
while (delay < 0) delay = sampleNormal(meanDelay, stdDevDelay)
104+
}
105+
97106
context.vars.nextDelay = delay
98-
logger.info(`Patient ${context.vars.nhsNumber} will think for ${context.vars.nextDelay} seconds`)
107+
logger.info(`Patient ${context.vars.nhsNumber} (on loop ${context.vars.loopcount}) will think for ${context.vars.nextDelay} seconds`)
99108

100109
next()
101110
}

0 commit comments

Comments
 (0)