1 | static double autoRestart_interval = 10; |
2 | static bool autoRestart_on, autoRestart_debug; |
3 | |
4 | static void autoRestart() {
|
5 | if (autoRestart_on) ret; |
6 | set autoRestart_on; |
7 | autoRestart_schedule(); |
8 | preloadProgramTitle(); |
9 | } |
10 | |
11 | svoid autoRestart_schedule {
|
12 | doLater_daemon(toMS(autoRestart_interval), f autoRestart_check); |
13 | } |
14 | |
15 | svoid autoRestart_check {
|
16 | try {
|
17 | S newMD5 = getServerTranspilationMD5(programID()); |
18 | if (!isMD5(newMD5)) { if (autoRestart_debug) print("autoRestart: no server transpilation"); ret; }
|
19 | S localMD5 = md5(loadCachedTranspilation(programID())); |
20 | |
21 | if (neq(localMD5, newMD5)) {
|
22 | if (!hasServerDex(programID())) {
|
23 | if (autoRestart_debug) print("autoRestart: Compilation failed");
|
24 | ret; |
25 | } |
26 | infoBox("Upgrading " + programTitle());
|
27 | restartWithDelay(1000); |
28 | sleep(); |
29 | } |
30 | } finally {
|
31 | if (autoRestart_debug) print("autoRestart: Done");
|
32 | autoRestart_schedule(); |
33 | } |
34 | } |
Began life as a copy of #1010683
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1010694 |
| Snippet name: | autoRestart v1 - auto-restart program on server change |
| Eternal ID of this version: | #1010694/1 |
| Text MD5: | c930aa0db132e44d688dd9111b53e053 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-09-25 19:30:09 |
| Source code size: | 971 bytes / 34 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 683 / 731 |
| Referenced in: | [show references] |