handleWorkerCrash static method

Future<void> handleWorkerCrash(
  1. AsyncNativeOdbcConnection async,
  2. Object error, [
  3. StackTrace? stackTrace
])

Logs the crash, disposes the async connection, and re-initializes a fresh worker. All previous connection IDs are invalid after this.

Use when the main isolate detects worker death (e.g. receivePort error, request timeouts). After return, the caller should re-connect and re-create any connection/pool state.

Implementation

static Future<void> handleWorkerCrash(
  AsyncNativeOdbcConnection async,
  Object error, [
  StackTrace? stackTrace,
]) async {
  AppLogger.severe('Worker isolate crashed: $error', error, stackTrace);
  async.dispose();
  await async.initialize();
}