edge/pkg/module/rpc/testdata/deadlock.js

15 lines
273 B
JavaScript
Raw Permalink Normal View History

2023-11-28 16:35:49 +01:00
function onInit() {
rpc.register("doSomethingLong", doSomethingLong)
}
function doSomethingLong(ctx, params) {
var start = Date.now()
while (true) {
var now = Date.now()
if (now - start >= params.delay) break
}
return params.i;
}