@nsshunt/ststestrunner 1.1.69 → 1.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ststestrunner.cjs +46 -16
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +46 -16
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +1 -1
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
- package/types/libmodule/workerFhirTestCases.d.ts +5 -0
- package/types/libmodule/workerFhirTestCases.d.ts.map +1 -1
package/dist/ststestrunner.mjs
CHANGED
|
@@ -131,25 +131,33 @@ var TestCaseFhirBase = class {
|
|
|
131
131
|
GetFhirSocketClient = async () => {
|
|
132
132
|
try {
|
|
133
133
|
this.#clientSocketFetchCount++;
|
|
134
|
-
const optionszz = this.runnerExecutionWorker.Options;
|
|
135
|
-
if (optionszz) {
|
|
136
|
-
console.log(`-----------------------------------------------------------------------------------------------------------------`);
|
|
137
|
-
console.log(`optionszz`);
|
|
138
|
-
console.log(optionszz);
|
|
139
|
-
console.log(this.runnerExecutionWorker.id);
|
|
140
|
-
console.log(`-----------------------------------------------------------------------------------------------------------------`);
|
|
141
|
-
} else {
|
|
142
|
-
console.log(`-----------------------------------------------------------------------------------------------------------------`);
|
|
143
|
-
console.log(`no optionszz`);
|
|
144
|
-
console.log(this.runnerExecutionWorker.id);
|
|
145
|
-
console.log(`-----------------------------------------------------------------------------------------------------------------`);
|
|
146
|
-
}
|
|
147
134
|
let fhirClient = this.runnerExecutionWorker.GetFhirClient();
|
|
148
135
|
if (fhirClient) {
|
|
149
|
-
|
|
136
|
+
this.Debug(chalk.green(`[${this.runnerExecutionWorker.id}] Getting existing fhir client`));
|
|
150
137
|
return fhirClient;
|
|
151
138
|
}
|
|
152
|
-
|
|
139
|
+
if (this.runnerExecutionWorker.GetOnHold("fhirclient") === true) {
|
|
140
|
+
this.Debug(chalk.magenta(`[${this.runnerExecutionWorker.id}] fhir client does not exist - some other client setting up the new client (on hold/lock) - waiting ...`));
|
|
141
|
+
try {
|
|
142
|
+
const start = performance.now();
|
|
143
|
+
await this.runnerExecutionWorker.WaitOnHold("fhirclient", 6e4);
|
|
144
|
+
this.Debug(chalk.yellow(`[${this.runnerExecutionWorker.id}] hold (lock) released after: [${performance.now() - start}ms]`));
|
|
145
|
+
const fhirClient = this.runnerExecutionWorker.GetFhirClient();
|
|
146
|
+
if (fhirClient) {
|
|
147
|
+
this.Debug(chalk.green(`[${this.runnerExecutionWorker.id}] Getting existing fhir client (post hold release)`));
|
|
148
|
+
return fhirClient;
|
|
149
|
+
} else {
|
|
150
|
+
this.Error(chalk.red(`[${this.runnerExecutionWorker.id}] Could not get existing fhir client (post hold release)`));
|
|
151
|
+
this.Error(chalk.red(`continue anyway ...`));
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
this.Error(chalk.red(`GetFhirSocketClient(): Error: [${error}]`));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const start = performance.now();
|
|
158
|
+
this.Debug(chalk.yellow(`[${this.runnerExecutionWorker.id}] fhir client does not exist - setting up new client`));
|
|
159
|
+
this.Debug(chalk.yellow(`[${this.runnerExecutionWorker.id}] setting hold (lock)`));
|
|
160
|
+
this.runnerExecutionWorker.SetOnHold("fhirclient");
|
|
153
161
|
const fhirOptions = this.#options.fhirOptions;
|
|
154
162
|
const options = {
|
|
155
163
|
fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
|
|
@@ -169,8 +177,10 @@ var TestCaseFhirBase = class {
|
|
|
169
177
|
if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
170
178
|
else fhirClient = new FhirSocketClientIndividual("FhirSocketClient", options);
|
|
171
179
|
await fhirClient.WaitForSocketConnected();
|
|
172
|
-
|
|
180
|
+
this.Debug(chalk.yellow(`[${this.runnerExecutionWorker.id}] setting fhir client into object`));
|
|
173
181
|
this.runnerExecutionWorker.SetFhirClient(fhirClient);
|
|
182
|
+
this.runnerExecutionWorker.ReleaseOnHold("fhirclient");
|
|
183
|
+
this.Debug(chalk.yellow(`[${this.runnerExecutionWorker.id}] release hold (lock) Time taken for socket connection and set object: [${performance.now() - start}ms]`));
|
|
174
184
|
return fhirClient;
|
|
175
185
|
} catch (error) {
|
|
176
186
|
this.LogErrorMessage(error);
|
|
@@ -35801,6 +35811,7 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
35801
35811
|
_resourceDataGenerator;
|
|
35802
35812
|
fhirClient = void 0;
|
|
35803
35813
|
_id = crypto.randomUUID();
|
|
35814
|
+
_onHoldKeys = {};
|
|
35804
35815
|
constructor(options) {
|
|
35805
35816
|
super();
|
|
35806
35817
|
this._options = options;
|
|
@@ -35837,6 +35848,25 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
35837
35848
|
myresponsepreterminate: `I got: [${JSON.stringify(messagePayload.payload.data)}]`
|
|
35838
35849
|
};
|
|
35839
35850
|
}
|
|
35851
|
+
GetOnHold = (holdKey) => {
|
|
35852
|
+
if (this._onHoldKeys[holdKey]) return true;
|
|
35853
|
+
return false;
|
|
35854
|
+
};
|
|
35855
|
+
WaitOnHold = async (holdKey, timeout) => {
|
|
35856
|
+
const start = performance.now();
|
|
35857
|
+
for (;;) {
|
|
35858
|
+
if (this._onHoldKeys[holdKey]) await Sleep(100);
|
|
35859
|
+
else break;
|
|
35860
|
+
if (performance.now() - start > timeout) throw new Error(`WaitOnHold timeout: [${timeout}] reached.`);
|
|
35861
|
+
}
|
|
35862
|
+
return true;
|
|
35863
|
+
};
|
|
35864
|
+
SetOnHold = (holdKey) => {
|
|
35865
|
+
this._onHoldKeys[holdKey] = true;
|
|
35866
|
+
};
|
|
35867
|
+
ReleaseOnHold = (holdKey) => {
|
|
35868
|
+
delete this._onHoldKeys[holdKey];
|
|
35869
|
+
};
|
|
35840
35870
|
};
|
|
35841
35871
|
//#endregion
|
|
35842
35872
|
export { WorkerFhirTestCases };
|