mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 07:41:58 +00:00
This commit improves memory management, reduces redundant interpreter instantiation, and standardizes service usage patterns. - Add `dispose()` to `ExtensionService` interface and implement it across Dart, JS, LNReader, and Mihon services. - Replace repeated interpreter creation in `DartExtensionService` with a persistent `_interpreter` instance initialized once in the constructor. - Add disposal logic for JS DOM selector and Cheerio instances to prevent memory leaks. - Introduce `withExtensionService()` helper to ensure services are always disposed after use. - Update call sites across the codebase to use `withExtensionService()` or manual try/finally disposal. - Improve isolate service message handling by extracting `responsePort` earlier. - Ensure safer defaults (e.g., returning empty lists, const lists) when service calls fail.
16 lines
558 B
Dart
16 lines
558 B
Dart
import 'package:mangayomi/eval/lib.dart';
|
|
import 'package:mangayomi/models/source.dart';
|
|
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
part 'supports_latest.g.dart';
|
|
|
|
@riverpod
|
|
bool supportsLatest(Ref ref, {required Source source}) {
|
|
final androidProxy = ref.read(androidProxyServerStateProvider);
|
|
final service = getExtensionService(source, androidProxy);
|
|
try {
|
|
return service.supportsLatest;
|
|
} finally {
|
|
service.dispose();
|
|
}
|
|
}
|