Skip to content

Commit

Permalink
Merge pull request #372 from ZIMkaRU/feature/strengthen-consistency-d…
Browse files Browse the repository at this point in the history
…ata-for-export

Strengthen consistency data for export
  • Loading branch information
ezewer authored Jun 4, 2024
2 parents f4e1ff5 + 660c993 commit 2929356
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

const { getMethodLimit } = require('../../limit-param.helpers')

const checkLength = (apiRes, apiMethodName) => {
if (apiMethodName === 'candles') {
return apiRes.length <= 1
}

return apiRes.length === 0
}

module.exports = (args, opts) => {
const {
apiRes,
Expand All @@ -27,7 +35,7 @@ module.exports = (args, opts) => {
)

return (
apiRes.length <= 1 || // Check makes sense to prevent double requests to api
checkLength(apiRes, apiMethodName) || // Check makes sense to prevent double requests to api
methodLimit > limit ||
apiRes.some((item) => (
item?.[datePropName] !== mts
Expand Down

0 comments on commit 2929356

Please sign in to comment.