fix: quick capture incorrectly treated as offline on LLM timeout
The global receiveTimeout is 30s but quick capture runs LLM inference that can take much longer. receiveTimeout fired, fell through to the NetworkException fallback in dioToApp, and the work queue queued it as an offline item. - quick_capture_api.dart: override receiveTimeout to 120s for the /api/quick-capture request - api_client.dart: handle receiveTimeout/sendTimeout explicitly in the error interceptor, converting them to AppException (not NetworkException) so slow responses are never mistaken for being offline Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,16 @@ class _ErrorInterceptor extends Interceptor {
|
||||
));
|
||||
return;
|
||||
}
|
||||
if (err.type == DioExceptionType.receiveTimeout ||
|
||||
err.type == DioExceptionType.sendTimeout) {
|
||||
handler.reject(DioException(
|
||||
requestOptions: err.requestOptions,
|
||||
error: const AppException('Request timed out. The server is taking too long to respond.'),
|
||||
type: err.type,
|
||||
response: err.response,
|
||||
));
|
||||
return;
|
||||
}
|
||||
handler.next(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class QuickCaptureApi {
|
||||
final response = await _dio.post(
|
||||
'/api/quick-capture',
|
||||
data: {'text': text},
|
||||
options: Options(receiveTimeout: const Duration(seconds: 120)),
|
||||
);
|
||||
return CaptureResult.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user