fix: [eaccount] SOAP 호출 크래시 방지 — WSDL 캐싱 + 소켓 타임아웃 + 진단 로깅
- WSDL_CACHE_NONE → WSDL_CACHE_BOTH (매 요청 WSDL 재다운로드 방지) - default_socket_timeout 60→120초 연장 - register_shutdown_function으로 Fatal Error 감지/로깅 - callSoap에 SOAP 호출 소요시간 로깅 추가
This commit is contained in:
@@ -92,7 +92,7 @@ private function initSoapClient(): void
|
||||
'exceptions' => true,
|
||||
'connection_timeout' => 30,
|
||||
'stream_context' => $context,
|
||||
'cache_wsdl' => WSDL_CACHE_NONE,
|
||||
'cache_wsdl' => WSDL_CACHE_BOTH,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('바로빌 계좌 SOAP 클라이언트 생성 실패: '.$e->getMessage());
|
||||
@@ -321,6 +321,23 @@ public function transactions(Request $request): JsonResponse
|
||||
@set_time_limit(120);
|
||||
}
|
||||
|
||||
// SOAP 호출 시 소켓 타임아웃도 연장
|
||||
$originalSocketTimeout = ini_get('default_socket_timeout');
|
||||
@ini_set('default_socket_timeout', '120');
|
||||
|
||||
// PHP 프로세스 크래시 감지용 shutdown handler
|
||||
register_shutdown_function(function () {
|
||||
$error = error_get_last();
|
||||
if ($error && in_array($error['type'], [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR])) {
|
||||
Log::error('[Eaccount] PHP Fatal Error 감지', [
|
||||
'type' => $error['type'],
|
||||
'message' => $error['message'],
|
||||
'file' => $error['file'],
|
||||
'line' => $error['line'],
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$startDate = $request->input('startDate', date('Ymd'));
|
||||
$endDate = $request->input('endDate', date('Ymd'));
|
||||
@@ -441,6 +458,11 @@ public function transactions(Request $request): JsonResponse
|
||||
'success' => false,
|
||||
'error' => '서버 오류: '.$e->getMessage().' ('.$e->getFile().':'.$e->getLine().')',
|
||||
]);
|
||||
} finally {
|
||||
// 소켓 타임아웃 복원
|
||||
if (isset($originalSocketTimeout)) {
|
||||
@ini_set('default_socket_timeout', $originalSocketTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2049,11 +2071,15 @@ private function callSoap(string $method, array $params = []): array
|
||||
}
|
||||
|
||||
try {
|
||||
Log::info("바로빌 계좌 API 호출 - Method: {$method}, CorpNum: {$this->corpNum}");
|
||||
Log::info("바로빌 계좌 API 호출 시작 - Method: {$method}, CorpNum: {$this->corpNum}");
|
||||
$soapStartTime = microtime(true);
|
||||
|
||||
$result = $this->soapClient->$method($params);
|
||||
$resultProperty = $method.'Result';
|
||||
|
||||
$elapsed = round((microtime(true) - $soapStartTime) * 1000);
|
||||
Log::info("바로빌 계좌 API 완료 - Method: {$method}, 소요시간: {$elapsed}ms");
|
||||
|
||||
if (isset($result->$resultProperty)) {
|
||||
$resultData = $result->$resultProperty;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user