mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor: replace OpenCode server restarts with config reloads for faster updates (#70)
This commit is contained in:
1 parent
8be0bbd8a0
commit
2bd2b024b8
11 files changed
+183
-107
No files matched your search
@@ -31,19 +31,19 @@ export function useServerHealth(enabled = true) {
|
||||
|
||||
const restartMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
return await settingsApi.restartOpenCodeServer()
|
||||
return await settingsApi.reloadOpenCodeConfig()
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['health'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['opencode', 'agents'] })
|
||||
toast.success('Server restarted successfully')
|
||||
toast.success('Server configuration reloaded successfully')
|
||||
},
|
||||
onError: (error: unknown) => {
|
||||
const errorMessage = error && typeof error === 'object' && 'response' in error
|
||||
? ((error as { response?: { data?: { details?: string; error?: string } } }).response?.data?.details
|
||||
|| (error as { response?: { data?: { details?: string; error?: string } } }).response?.data?.error
|
||||
|| 'Failed to restart server')
|
||||
: 'Failed to restart server'
|
||||
|| 'Failed to reload configuration')
|
||||
: 'Failed to reload configuration'
|
||||
toast.error(errorMessage)
|
||||
},
|
||||
})
|
||||
@@ -81,7 +81,7 @@ export function useServerHealth(enabled = true) {
|
||||
toast.error(health.error || 'OpenCode server is currently unhealthy', {
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: 'Restart',
|
||||
label: 'Reload',
|
||||
onClick: () => restartMutation.mutate(),
|
||||
},
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user