Use websocket (nchan) instead of ajax polling to refresh data in dashboard#28
Use websocket (nchan) instead of ajax polling to refresh data in dashboard#28Peuuuur-Noel wants to merge 8 commits intoSimonFair:masterfrom
Conversation
…shboard - All apps usage statuses are no longer sent, only active apps
|
Forgot to mention it, but you have to |
|
|
||
| // Restart nchan gpustat if not running when refresh setting set to Yes | ||
| $pid = exec('pgrep gpustat'); | ||
| if (!$pid && $_POST['UIREFRESH'] == '1' && $gpustat_cfg['UIREFRESH'] != '1') { |
There was a problem hiding this comment.
This should be started automatically when you go back to the dashboard so not sure if this is needed. There is a file in var/run called nchan.pid which contains the running nchan processes but would need to confirm the correct way to stop a process.
There was a problem hiding this comment.
I thought about it too, but monitor_nchan doesn't restart it if path to gpustat is present in /var/run/nchan.pid.
I didn't find a proper way to stop a nchan process. The only way to stop a process is by adding :stop in .page header to nchan attribut, but it's only for a single run. Process killed after 30 seconds.
I made change to remove process path in nchan.pid and stop process itself if refresh set to No. Dashboard will restart it every time if necessary.
Removed code from GPUStatSettings.page and updated here:
gpustat-unraid/src/gpustat/usr/local/emhttp/plugins/gpustat/nchan/gpustat
Lines 106 to 110 in 563471b
| } | ||
| } | ||
| } | ||
| $this->pageData[$app . 'using'] = true; |
There was a problem hiding this comment.
These would still be required for non multi i.e. pre 6.12 unless same changes are applied to the pages and js as this common for both.
There was a problem hiding this comment.
I also updated code for pre 6.12.
Both versions (multigpu and non multigpu) use websocket.
There was a problem hiding this comment.
nchan can only be used if os is 6.10 or greater. Not sure if there will be users running pre 6.10 Non multy should use ajax updates for backwards compatibilty.
There was a problem hiding this comment.
I will revert it and use ajax polling for non multigpu. Sorry.
There was a problem hiding this comment.
I reverted to ajax polling for non multi.
- Update refresh for non multi (Unraid pre 6.12)
Uh oh!
There was an error while loading. Please reload this page.