Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
36371 12 d 1 h amit /trunk/ HDFC webhook: INSERT IGNORE on hdfc_payment to fix concurrent-duplicate 500 storm

Replaces persist() with a native INSERT IGNORE so concurrent same-UTR webhook
retries serialize on the unique-index check, and the loser gets a 0-row no-op
(warning, not exception). Outer @Transactional session stays clean, Spring
commits normally, HDFC sees 200 on both the winner (Success) and the loser
(Duplicate) - retry amplification ends.

Flow:
persist(hdfcPayment) -> insertIgnore(hdfcPayment) + selectByUtrNo(utr)
- inserted == 1: proceed with wallet / sidbi side-effects using fetched id
- inserted == 0: respond Duplicate, skip side-effects (owned by winning tx)
- defensive: log warn if insertIgnore returned 0 but selectByUtrNo finds
no row (could mean IGNORE swallowed a non-duplicate issue like truncation)

Also drops HdfcProcessingHelper (r36366) which used REQUIRES_NEW for the same
goal; that approach required a second JDBC connection and is no longer needed
with SQL-level idempotency.

Does NOT touch the wallet-side lost-update hole (user_wallet read-modify-write
without FOR UPDATE). That is a separate commit.
 
36370 12 d 14 h vikas /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fix: App login  
36369 12 d 17 h vikas /trunk/profitmandi-fofo/src/main/ Fix: Sale purchase invoice item quantity calculation  
36367 12 d 20 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/hdfc/ HDFC webhook: delegate writes to HdfcProcessingHelper; always respond OK

Fixes the concurrent-duplicate deadlock observed on hadb1 2026-04-23 12:54:11
(two HDFC retries inserting same utr='308490624083' → InnoDB deadlock →
LockAcquisitionException → 500 → HDFC retries again → amplification).

- addPayment: the HDFC row build + persist + wallet/sidbi is now a single call
to hdfcProcessingHelper.processPayment() which runs in REQUIRES_NEW. The
helper catches DataIntegrityViolationException and logs silently; our tx
is unaffected.
- The else branch (pre-select found an existing row) now returns the same
code=100 status=Success as the main path instead of code=200 Duplicate.
Per product direction: HDFC should see 'OK' regardless of whether the row
already existed from a prior webhook, manual entry, or reconciliation —
retries stop cleanly, no 'Duplicate' surface distinction.

Did NOT add @Transactional(readOnly=true) on the outer method despite its
read-heavy shape — checkManualPayments() at line 277 has a write side-effect
(rejecting pending manual wallet requests for the same utr) which would be
silently dropped in a read-only session. Kept class-level writable tx for
the outer; only HDFC writes moved to REQUIRES_NEW helper.
 
36363 13 d 17 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Idempotent fofo_order creation in UpSaleController (mirrors r36362 in dao)

Same change as OrderServiceImpl.createAndGetFofoOrder: pre-select by
(fofo_id, invoice_number) and catch DataIntegrityViolationException as the
slow-race fallback. Paired with uk_fofo_order_fofo_invoice unique key.
 
36360 13 d 19 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ login talktime hours cap on 100%  
36356 13 d 20 h ranu /trunk/ rbm rating dashboard view commited  
36352 13 d 22 h amit /trunk/profitmandi-fofo/src/main/ Add admin cron batch review UI at /admin/cron-batches. Single page lists recent 200 batches grouped by date (most recent on top), clicking a row opens a modal with per-partner items (fofoId, partner, status, error, timestamps). Manual Refresh button re-fetches JSON. Admin-only via roleManager.isAdmin. Uses existing velocity layout (1-line passthrough). Three endpoints: GET /admin/cron-batches (HTML), /list (JSON), /{batchId}/items (JSON). Uses dao r36351 repo methods.  
36348 13 d 22 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ /offer/process/{offerId} now fire-and-forget: calls offerBatchService.submitBatchAsync (dao r36347) and returns the status message immediately. User no longer waits on the 5+ min batch run; duplicate clicks for the same offer return 'already being processed' instead of spawning parallel deadlocking batches.  
36344 14 d 1 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Route /offer/process/{offerId} through OfferBatchService (dao r36342). Per-partner REQUIRES_NEW replaces the single outer transaction — fixes lock-acquisition failures (e.g. offer 8802) by releasing row locks between partners and isolating per-partner failures in cron_batch_item instead of aborting the whole run.  
36341 14 d 1 h aman /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fix:Remove Fin-service team from wod request mail  
36340 14 d 1 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/warehouse/ Narrow downloadInvoice: release JDBC before PDF streaming + clean error codes

OrderManagementController has class-level @Transactional(rollbackFor=Throwable),
so every downloadInvoice request held a Hikari connection for the entire HTTP
response duration — including the PDF streaming phase over a user's (often
slow) mobile network. The endpoint is the #1 JDBC-slot holder in production.

- Method-level @Transactional(propagation = NOT_SUPPORTED) suspends the
class-level tx for this endpoint so no connection is held by default.
- A short read-only TransactionTemplate scopes the single SELECT (order lookup
by invoice number) inside its own tx. Connection returns to the pool as soon
as the SELECT commits; file streaming then runs without any JDBC session.
- Bounds-check orders.isEmpty() — 2 IndexOutOfBoundsException per log window
previously, now a clean 404 with message body.
- Invoice-not-yet-generated stops surfacing as a 500 with stack trace
(1,534 occurrences in yesterday's log = #1 noise source). Now a 404 with
'please retry shortly' JSON body. Saves log disk and error-budget.
 
36334 14 d 19 h ranu /trunk/ rbm rating dashboard view commited  
36325 15 d 1 h aman /trunk/profitmandi-fofo/src/main/ Fix: Tier-Based Referral Payout  
36316 15 d 18 h aman /trunk/ Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO  
36315 15 d 22 h ranu /trunk/ rbm rating dashboard view commited  
36312 16 d 5 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ rbm rating dashboard view commited  
36307 16 d 19 h ranu /trunk/profitmandi-fofo/src/main/ rbm rating dashboard view commited  
36299 18 d 21 h amit /trunk/profitmandi-fofo/src/main/ GRN correction: surface autoApproved flag to UI

Controller returns {status, autoApproved} JSON; JS shows an
'auto-approved' message when the request bypasses approval, otherwise
the existing 'raised for approval' message. Pairs with dao r36298.
 
36297 18 d 22 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ Fix MonitorController autowiring after @Cacheable proxy

UserWalletRepositoryImpl now has @Cacheable (r36296), which makes Spring
wrap it in a JDK interface proxy. MonitorController autowired the concrete
class, breaking startup with BeanNotOfRequiredTypeException. Switch to the
interface UserWalletRepository, matching every other repository injection
in the file.
 

Show All