Created
April 8, 2025 10:51
-
-
Save knopki/fb639c7fcf15a73640b0b7711904ad41 to your computer and use it in GitHub Desktop.
ODOO RPC pinger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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