Skip to content

Commit

Permalink
fix: unresponsive state when cpu gpu mining are off (#1019)
Browse files Browse the repository at this point in the history
## Fixes #635 
### [ Content ]
- Adjusted if statements in `setGpuMiningEnabled` and
`setCpuMiningEnabled`

---------

Co-authored-by: Brian Pearce <[email protected]>
  • Loading branch information
Misieq01 and brianp authored Nov 6, 2024
1 parent b737254 commit 84bcdc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/store/useAppConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ export const useAppConfigStore = create<AppConfigStoreState>()((set, getState) =
}
invoke('set_cpu_mining_enabled', { enabled })
.then(async () => {
if (miningState.miningInitiated) {
if (miningState.miningInitiated && (enabled || miningState.gpu.mining.is_mining)) {
await miningState.startMining();
} else {
miningState.stopMining();
}
})
.catch((e) => {
Expand All @@ -164,10 +166,13 @@ export const useAppConfigStore = create<AppConfigStoreState>()((set, getState) =
if (miningState.cpu.mining.is_mining || miningState.gpu.mining.is_mining) {
await miningState.pauseMining();
}

invoke('set_gpu_mining_enabled', { enabled })
.then(async () => {
if (miningState.miningInitiated) {
if (miningState.miningInitiated && (miningState.cpu.mining.is_mining || enabled)) {
await miningState.startMining();
} else {
miningState.stopMining();
}
})
.catch((e) => {
Expand Down

0 comments on commit 84bcdc5

Please sign in to comment.