fix(reconcile): connect mongoose before querying members
Route was the only DB-using endpoint that didn't call connectDB(); other routes warm the connection incidentally, but on a freshly-booted container with no SLACK_BOT_TOKEN the slack-joins plugin skips and nothing else opens the pool — first reconcile request hung 10s on buffered Member.find() and returned 500.
This commit is contained in:
parent
0369992cdd
commit
a2a8d945c6
1 changed files with 3 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
|||
import Member from '../../models/member.js'
|
||||
import Payment from '../../models/payment.js'
|
||||
import { listHelcimCustomerTransactions } from '../../utils/helcim.js'
|
||||
import { connectDB } from '../../utils/mongoose.js'
|
||||
import { upsertPaymentFromHelcim } from '../../utils/payments.js'
|
||||
|
||||
// Same filter upsertPaymentFromHelcim applies — keep dry-run summary in sync.
|
||||
|
|
@ -51,6 +52,8 @@ export default defineEventHandler(async (event) => {
|
|||
|
||||
const apply = getQuery(event).apply !== 'false'
|
||||
|
||||
await connectDB()
|
||||
|
||||
const members = await Member.find(
|
||||
{ helcimCustomerId: { $exists: true, $ne: null } },
|
||||
{ _id: 1, email: 1, name: 1, helcimCustomerId: 1, helcimSubscriptionId: 1, billingCadence: 1 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue