Commit Graph

10 Commits

Author SHA1 Message Date
f64ae42825 Fix Prisma
1 fix: error koneksi Prisma dengan retry mechanism
      2
      3 Perubahan:
      4 - src/lib/prisma.ts: Tambah retry (3x) dengan exponential backoff saat connect
      5 - src/lib/prisma-retry.ts: NEW - Utility wrapper untuk retry operations
      6 - src/app/api/user-validate/route.ts: Improve error logging dengan detail
      7 - src/middleware.tsx: Clean up commented code
      8
      9 Fitur:
     10 - Auto retry saat database connection gagal
     11 - Explicit () di production
     12 - Better error logging untuk debugging
     13 - Reusable retry wrapper (withRetry, withTimeout)
     14
     15 Testing:
     16 - Build berhasil 
     17 - Type checking passed 
     18
     19 Fixes: Error in PostgreSQL connection: Error { kind: Closed, cause: None }

### No Issue
2026-03-03 15:30:34 +08:00
d43f3762a3 Fixed Bug Server
## Summary
This branch contains several bug fixes and performance improvements, primarily focusing on:
- Database connection management
- MQTT client stability
- Logging optimization
- API enhancements

## Detailed Changes

### Fixed Issues
1. **Database Connection Management**
   - Removed  from user-validate API route to prevent connection pool exhaustion
   - Added proper connection handling in global Prisma setup
   - Reduced logging verbosity in production environments

2. **MQTT Client Improvements**
   - Enhanced MQTT client initialization with proper error handling
   - Added reconnection logic with configurable intervals
   - Implemented cleanup functions to prevent memory leaks
   - Added separate initialization logic for server and client-side code

3. **Logging Optimization**
   - Removed excessive logging in middleware that was causing high CPU usage
   - Configured appropriate log levels for development and production

4. **Component Stability**
   - Added safety checks in text editor component to prevent MQTT operations on the server side
   - Improved MQTT publishing logic with client availability checks

### New Files
-  - Utility functions for safe database operations

### Modified Files
1.
   - Removed problematic  call

2.
   - Configured different logging levels for dev/prod
   - Removed process listeners that were causing disconnections
   - Exported prisma instance separately

3.
   - Removed excessive logging statements

4.
   - Enhanced initialization with error handling
   - Added reconnection and timeout configurations

5.
   - Added proper cleanup functions
   - Improved connection handling

6.
   - Added MQTT client availability checks
   - Prevented server-side MQTT operations

### Performance Improvements
- Reduced database connection overhead
- Optimized MQTT connection handling
- Eliminated unnecessary logging in production
- Better memory management with proper cleanup functions

### No Issue
2026-02-12 16:29:03 +08:00
dbe56f364e fix middleware
deskrispi:
- perbaiki middleware untuk versi diatas 1.4.6
No Issuee
2025-05-22 11:47:59 +08:00
12f12a82b5 fix user validation 2025-04-08 10:33:03 +08:00
d68a39066a fix prisma import 2025-02-21 16:13:13 +08:00
f419559379 fix lib
deskripsi:
- pindah lib di dalam app ke src ( lib setara app dan app_modules )
2025-02-12 10:57:10 +08:00
d7252b9fb3 fix folder
deskripsi:
- ganti nama folder (user) ke (auth)
- hapus folder auth
2025-02-05 15:34:06 +08:00
6dc4e7afc3 fix middleware 2025-02-05 15:07:18 +08:00
b03f242af4 fix event admin 2025-02-03 12:34:13 +08:00
cccb011da5 fix ( middleware )
deskripsi:
- fix access api melalui middleware di: home, profile dan portofolio
2025-01-08 10:39:18 +08:00