mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
improve update logic
This commit is contained in:
parent
8b7d79162d
commit
c762009a6f
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="d-flex flex-align-center">
|
||||
<b-button class="m-1 mr-3" variant="secondary" size="sm" @click="refreshFull(true)">
|
||||
<b-button class="m-1 mr-3" variant="secondary" size="sm" @click="allRefreshFull(true)">
|
||||
<RefreshIcon :size="16" />
|
||||
</b-button>
|
||||
|
||||
|
@ -50,13 +50,7 @@ export default class ReloadControl extends Vue {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@ftbot.Action setAutoRefresh!: (newValue: boolean) => void;
|
||||
|
||||
@ftbot.Action refreshFull;
|
||||
|
||||
@ftbot.Action refreshOnce;
|
||||
|
||||
@ftbot.Action startRefresh;
|
||||
|
||||
@ftbot.Action stopRefresh;
|
||||
@ftbot.Action allRefreshFull;
|
||||
|
||||
get autoRefreshLoc() {
|
||||
return this.autoRefresh;
|
||||
|
|
|
@ -145,10 +145,7 @@ export default function createBotStore(store) {
|
|||
allRefreshFrequent({ dispatch, getters }, slow: boolean) {
|
||||
console.log('dispatching all frequent refreshes');
|
||||
getters.allAvailableBotsList.forEach((e) => {
|
||||
if (
|
||||
getters[`${e}/${BotStoreGetters.autoRefresh}`] &&
|
||||
getters[`${e}/${BotStoreGetters.isBotOnline}`]
|
||||
) {
|
||||
if (getters[`${e}/${BotStoreGetters.refreshNow}`]) {
|
||||
// console.log('refreshing', e);
|
||||
dispatch(`${e}/${BotStoreActions.refreshFrequent}`, slow);
|
||||
}
|
||||
|
@ -157,25 +154,24 @@ export default function createBotStore(store) {
|
|||
allRefreshSlow({ dispatch, getters }) {
|
||||
console.log('dispatching all slow refreshes');
|
||||
getters.allAvailableBotsList.forEach((e) => {
|
||||
if (
|
||||
getters[`${e}/${BotStoreGetters.autoRefresh}`] &&
|
||||
getters[`${e}/${BotStoreGetters.isBotOnline}`]
|
||||
) {
|
||||
if (getters[`${e}/${BotStoreGetters.refreshNow}`]) {
|
||||
dispatch(`${e}/${BotStoreActions.refreshSlow}`);
|
||||
}
|
||||
});
|
||||
},
|
||||
async refreshxxFull({ commit, dispatch, getters, state }, forceUpdate = false) {
|
||||
async allRefreshFull({ commit, dispatch, state }, forceUpdate = false) {
|
||||
if (state.refreshing) {
|
||||
return;
|
||||
}
|
||||
commit('setRefreshing', true);
|
||||
try {
|
||||
// Ensure all bots status is correct.
|
||||
await dispatch('pingAll');
|
||||
const updates: Promise<AxiosInstance>[] = [];
|
||||
updates.push(dispatch('refreshFrequent', false));
|
||||
updates.push(dispatch('refreshSlow', forceUpdate));
|
||||
updates.push(dispatch('getDaily'));
|
||||
updates.push(dispatch('getBalance'));
|
||||
updates.push(dispatch('allRefreshFrequent', false));
|
||||
updates.push(dispatch('allRefreshSlow'));
|
||||
// updates.push(dispatch('getDaily'));
|
||||
// updates.push(dispatch('getBalance'));
|
||||
|
||||
await Promise.all(updates);
|
||||
console.log('refreshing_end');
|
||||
|
|
|
@ -159,7 +159,7 @@ export function createBotSubStore(botId: string) {
|
|||
[BotStoreGetters.refreshNow](state, getters, rootState, rootGetters): boolean {
|
||||
const bgRefresh = rootGetters['uiSettings/backgroundSync'];
|
||||
const selectedBot = rootGetters['ftbot/selectedBot'];
|
||||
if ((selectedBot === botId || bgRefresh) && getters.autoRefresh) {
|
||||
if ((selectedBot === botId || bgRefresh) && getters.autoRefresh && getters.isBotOnline) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user