Skip to content

Commit

Permalink
fix: remove unnecessary read preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Nov 5, 2024
1 parent 6fa3c9c commit 7e705e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
5 changes: 4 additions & 1 deletion core/api/src/servers/exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ const main = async () => {
activateLndHealthCheck()
}

setupMongoConnection()
setupMongoConnection({
syncIndexes: false,
options: { readPreference: "secondaryPreferred" },
})
.then(() => main())
.catch((err) => logger.error(err))

Expand Down
18 changes: 6 additions & 12 deletions core/api/src/services/ledger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,9 @@ export const LedgerService = (): ILedgerService => {
): Promise<Satoshis | LedgerError> => {
const liabilitiesWalletId = toLiabilitiesWalletId(walletId)
try {
const { balance } = await MainBook.balance(
{
account: liabilitiesWalletId,
},
{ readPreference: "primaryPreferred" },
)
const { balance } = await MainBook.balance({
account: liabilitiesWalletId,
})
if (balance < 0) {
const dealerUsdWalletId = await caching.getDealerUsdWalletId()
const dealerBtcWalletId = await caching.getDealerBtcWalletId()
Expand All @@ -343,12 +340,9 @@ export const LedgerService = (): ILedgerService => {
): Promise<BalanceAmount<S> | LedgerError> => {
const liabilitiesWalletId = toLiabilitiesWalletId(walletDescriptor.id)
try {
const { balance } = await MainBook.balance(
{
account: liabilitiesWalletId,
},
{ readPreference: "primaryPreferred" },
)
const { balance } = await MainBook.balance({
account: liabilitiesWalletId,
})
if (balance < 0) {
const dealerWalletIds = Object.values(await caching.getDealerWalletIds())

Expand Down

0 comments on commit 7e705e7

Please sign in to comment.