MCPcopy Create free account
hub / github.com/reactnativecn/react-native-update / poll

Function poll

Example/testHotUpdate/e2e/globalSetup.js:68–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67 return new Promise((resolve, reject) => {
68 const poll = () => {
69 const req = http.get(url, res => {
70 if (res.statusCode === 200) {
71 resolve(void 0);
72 return;
73 }
74 retry();
75 });
76 req.on('error', retry);
77 req.setTimeout(1000, () => {
78 req.destroy();
79 retry();
80 });
81 };
82
83 const retry = () => {
84 if (Date.now() - start > timeoutMs) {

Callers 1

waitForServerFunction · 0.70

Calls 2

onMethod · 0.80
retryFunction · 0.70

Tested by

no test coverage detected