Skip to content

Instantly share code, notes, and snippets.

@knopki
Created April 8, 2025 10:51
Show Gist options
  • Select an option

  • Save knopki/fb639c7fcf15a73640b0b7711904ad41 to your computer and use it in GitHub Desktop.

Select an option

Save knopki/fb639c7fcf15a73640b0b7711904ad41 to your computer and use it in GitHub Desktop.
ODOO RPC pinger
let rpc = odoo.__DEBUG__.services['web.rpc']
let doQuery = async () => rpc.query({
// change this
context: {},
model: "mrp.production",
method: "read",
args: [[49759]],
});
let doPing = async () => {
const now = Date.now();
try {
await doQuery();
} catch (e) {
console.error(e);
}
const now2 = Date.now();
return now2 - now;
}
let doPings = async () => {
setInterval(async () => {
let roundtrip = await doPing();
console.log((new Date()).toLocaleTimeString(), roundtrip);
}, 5000);
};
doPings();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment