Skip to content

Commit

Permalink
Merge pull request #208 from rsksmart/feat/optimize-backend-queries
Browse files Browse the repository at this point in the history
Feat/optimize backend queries
  • Loading branch information
ezequiel-rodriguez authored Mar 22, 2024
2 parents 7245d4b + 465e1d9 commit a1f3e6d
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 32 deletions.
8 changes: 1 addition & 7 deletions src/config/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,4 @@ export const CHECKSUM_WARN = {
}
}

export const BALANCES_WARN = {
title: 'Note:',
txt: 'Showing balances between blocks: #@fromBlock and #@toBlock',
type: 'warn'
}

export default { DB_OUTDATED, INTERNAL_TX_WARN, CHECKSUM_WARN, BALANCES_WARN }
export default { DB_OUTDATED, INTERNAL_TX_WARN, CHECKSUM_WARN }
4 changes: 1 addition & 3 deletions src/router/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ROUTES as r } from '../config/types'
import { TRANSFER_EVENTS_SIGNATURES } from '../config/entities/lib/eventsLib'
import store from '../store/'
import { fillMessage, CHECKSUM_WARN } from '../config/messages'
import { balancesMessages } from './balances'

export default [
{
Expand Down Expand Up @@ -109,8 +108,7 @@ export default [
name: 'balances',
dataType: 'balances',
module: 'balances',
action: 'getBalances',
msgs: balancesMessages
action: 'getBalances'
},
{
name: 'mined blocks',
Expand Down
12 changes: 1 addition & 11 deletions src/router/balances.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import DataPage from '@/components/DataPage'
import { ROUTES as r } from '../config/types'
import store from '../store/'
import { fillMessage, BALANCES_WARN } from '../config/messages'

const module = 'balances'

export const balancesMessages = data => {
let { fromBlock, toBlock } = store.getters.getBalancesStatus
fromBlock = fromBlock.blockNumber
toBlock = toBlock.blockNumber
return [fillMessage(BALANCES_WARN, { fromBlock, toBlock })]
}

export default [
{
path: `/${r.balances}/:address`,
Expand All @@ -21,8 +12,7 @@ export default [
module,
title: 'Account Balances',
dataType: 'balances',
action: 'getBalances',
msgs: balancesMessages
action: 'getBalances'
}
},
{
Expand Down
4 changes: 0 additions & 4 deletions src/store/modules/backend/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ export const socketDbStatus = ({ state, commit }, data) => {
commit('SET_DB_STATUS', data)
}

export const socketBalancesStatus = ({ state, commit }, data) => {
commit('SET_BALANCES_STATUS', data)
}

export const fetchData = ({ state, commit, getters }, req) => {
req.params = req.params || {}
const { next, prev, query, sort, action, count, page, fields } = req
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/backend/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ export const isResponseBlockUpdated = (state, getters) => key => {
if (metadata.block && lastBlock) return metadata.block.hash === lastBlock.hash
}

export const getBalancesStatus = state => state.balancesStatus

export const isExportKey = state => key => {
const value = state.exports[key]
return value !== undefined && value !== null
Expand Down
4 changes: 0 additions & 4 deletions src/store/modules/backend/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ export const SET_STATS = (state, data) => {
Vue.set(state, 'stats', data)
}

export const SET_BALANCES_STATUS = (state, data) => {
Vue.set(state, 'balancesStatus', data)
}

export const SET_EXPORT_KEY = (state, key) => {
Vue.set(state.exports, key, { total: undefined, received: 0, timestamp: undefined })
}
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/backend/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function () {
lastBlocks: [],
pendingBlocks: {},
dbStatus: {},
balancesStatus: {},
missingBlocks: {
blocks: 1,
time: 0
Expand Down

0 comments on commit a1f3e6d

Please sign in to comment.