MCPcopy Create free account
hub / github.com/angular/dev-infra / _resume

Function _resume

github-actions/browserstack/set-browserstack-env.js:8229–8291  ·  view source on GitHub ↗
(client, sync)

Source from the content-addressed store, hash-verified

8227 client[kNeedDrain] = 0;
8228 client.emit("drain", client[kUrl], [client]);
8229 }
8230 function resume(client, sync) {
8231 if (client[kResuming] === 2) {
8232 return;
8233 }
8234 client[kResuming] = 2;
8235 _resume(client, sync);
8236 client[kResuming] = 0;
8237 if (client[kRunningIdx] > 256) {
8238 client[kQueue].splice(0, client[kRunningIdx]);
8239 client[kPendingIdx] -= client[kRunningIdx];
8240 client[kRunningIdx] = 0;
8241 }
8242 }
8243 function _resume(client, sync) {
8244 var _a;
8245 while (true) {
8246 if (client.destroyed) {
8247 assert(client[kPending] === 0);
8248 return;
8249 }
8250 if (client[kClosedResolve] && !client[kSize]) {
8251 client[kClosedResolve]();
8252 client[kClosedResolve] = null;
8253 return;
8254 }
8255 if (client[kHTTPContext]) {
8256 client[kHTTPContext].resume();
8257 }
8258 if (client[kBusy]) {
8259 client[kNeedDrain] = 2;
8260 } else if (client[kNeedDrain] === 2) {
8261 if (sync) {
8262 client[kNeedDrain] = 1;
8263 queueMicrotask(() => emitDrain(client));
8264 } else {
8265 emitDrain(client);
8266 }
8267 continue;
8268 }
8269 if (client[kPending] === 0) {
8270 return;
8271 }
8272 if (client[kRunning] >= (getPipelining(client) || 1)) {
8273 return;
8274 }
8275 const request = client[kQueue][client[kPendingIdx]];
8276 if (client[kUrl].protocol === "https:" && client[kServerName] !== request.servername) {
8277 if (client[kRunning] > 0) {
8278 return;
8279 }
8280 client[kServerName] = request.servername;
8281 (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => {
8282 client[kHTTPContext] = null;
8283 resume(client);
8284 });
8285 }
8286 if (client[kConnecting]) {

Callers 1

resumeFunction · 0.70

Calls 7

emitDrainFunction · 0.70
getPipeliningFunction · 0.70
resumeFunction · 0.70
connectFunction · 0.70
resumeMethod · 0.45
destroyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected