Refactor LoRa airtime tests and add new functionality
- Updated LoRa airtime calculations in `lora_airtime_test.dart` to reflect new reference values. - Introduced new tests for LDRO behavior and preamble symbol calculations. - Added `contact_path_width_test.dart` to validate path hash width handling in contacts. - Enhanced `model_changes_test.dart` to ensure legacy data migration works correctly. - Created `remote_node_stats_test.dart` to decode and validate remote node statistics. - Implemented `map_marker_parse_test.dart` for parsing marker text with coordinate validation. - Developed `map_tile_cache_key_test.dart` to ensure API keys are excluded from cache keys. - Added `message_retry_failure_test.dart` to test message retry service behavior on failures. - Extended `path_history_service_test.dart` to preserve learned state across path attempts. - Enhanced `received_image_store_test.dart` to handle concurrent writes and review fixes. - Implemented `repeater_command_service_test.dart` to validate command response handling. - Created `store_tolerant_parsing_test.dart` to ensure stores skip malformed records gracefully. - Cleared untranslated JSON file for localization updates.
This commit is contained in:
1 parent
d5f54dfa11
commit
d74587c167
105 files changed
+6419
-2072
No files matched your search
@@ -90,6 +90,10 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
String? _lastError;
|
||||
Future<void> _queue = Future<void>.value();
|
||||
ImageCodecSession? _session;
|
||||
|
||||
/// Teardown started by [handleMemoryPressure]; [_ensureSession] waits for it
|
||||
/// so a second isolate is never spawned while the first is still resident.
|
||||
Future<void>? _pendingRelease;
|
||||
ImageCodecBundle? _loadedBundle;
|
||||
ImageCodecBundle? _failedBundle;
|
||||
int _downloadedBytes = 0;
|
||||
@@ -1339,6 +1343,12 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
// ---- model memory (mirrors translation_service.dart:586-629) -------------
|
||||
|
||||
Future<ImageCodecSession?> _ensureSession(ImageCodecBundle bundle) async {
|
||||
final pendingRelease = _pendingRelease;
|
||||
if (pendingRelease != null) {
|
||||
try {
|
||||
await pendingRelease;
|
||||
} catch (_) {}
|
||||
}
|
||||
if (_session != null && _loadedBundle == bundle) {
|
||||
return _session;
|
||||
}
|
||||
@@ -1455,8 +1465,16 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
if (session != null) {
|
||||
// Ask for the big half back before the shutdown handshake, so the peak
|
||||
// does not have to wait on isolate teardown.
|
||||
await session.release(decoder: true);
|
||||
await session.dispose();
|
||||
final release = () async {
|
||||
await session.release(decoder: true);
|
||||
await session.dispose();
|
||||
}();
|
||||
_pendingRelease = release;
|
||||
try {
|
||||
await release;
|
||||
} finally {
|
||||
if (identical(_pendingRelease, release)) _pendingRelease = null;
|
||||
}
|
||||
}
|
||||
appLogger.info('Image codec model evicted', tag: 'ImageCodec');
|
||||
_notify();
|
||||
|
||||
Reference in new issue
Block a user