Repository navigation
Fix: Tambahkan timeout dan penanganan error pada pemanggilan HTTP keluar - #1807
Merged
Merged
Conversation
- Tambah App\Support\OutboundHttp sebagai satu-satunya pembuat klien HTTP keluar, dengan batas waktu dari config/http.php (HTTP_TIMEOUT, HTTP_CONNECT_TIMEOUT, HTTP_TTE_TIMEOUT).
- Terapkan ke semua pemanggilan Http:: dan Guzzle Client yang sebelumnya tanpa timeout.
- Pemanggilan TTE dipindah ke luar transaksi DB agar server TTE yang lambat tidak menahan transaksi.
- Gabungkan kode kirimTrack yang duplikat di Controller dan GlobalShareMiddleware menjadi trait KirimTrackPantau.
- Ganti ->object()->message dengan ->json('message') agar respons error non-JSON tidak memicu error.
Closes #1805
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Contributor
|
🔄 AI PR Review sedang antri di server...
|
Trait tidak mengimpor Program sehingga memicu "Class App\Traits\Program not found" pada setiap request web. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ringkasan
Menangani issue #1805: pemanggilan HTTP keluar di luar
ApiServicebelum memakai timeout eksplisit, dan beberapa belum menangani respons error non-JSON.Perubahan
App\Support\OutboundHttpmenjadi satu-satunya pembuat klien HTTP keluar. Batas waktu diambil dariconfig/http.phpdan bisa diatur lewatHTTP_TIMEOUT,HTTP_CONNECT_TIMEOUT,HTTP_TTE_TIMEOUT(ditambahkan di.env.example).Http::dan Guzzlenew Client()yang sebelumnya tanpa timeout:ApiService,BaseApiService,LaporanPendudukService,SuratController,OtpService,DataDesaController, dan service statistik penduduk/chart.PermohonanController::passphrasememanggil server TTE sebelumDB::beginTransaction(), sehingga server yang lambat tidak menahan transaksi database. Timeout TTE memakaiHTTP_TTE_TIMEOUT(default 60 detik).kirimTrack()yang sama diControllerdanGlobalShareMiddlewaredipindah ke traitApp\Traits\KirimTrackPantau.->object()->messagediganti->json('message')diApiService::terdaftar.Di luar cakupan
MediaLinkServicesudah memakai timeout 5 detik, tidak diubah.helpers/general_helper.php(get_headersdengan timeout 3) tidak diubah.Cara menguji
DB_PASSWORD=rahasia php vendor/bin/pest tests/Unit/Support/OutboundHttpTest.php tests/Unit/Services/ApiServiceTest.phpDB_PASSWORD=rahasia php vendor/bin/pest tests/Unit --parallel(9 tes gagal saat paralel karena berbagi database, dan lolos saat dijalankan serial)Closes #1805
🤖 Generated with Claude Code