Configurable nav timeout

This commit is contained in:
stopflock
2025-12-03 15:04:43 -06:00
parent d6519a76bf
commit b176724fc5
4 changed files with 12 additions and 3 deletions

View File

@@ -1,4 +1,10 @@
{
"1.6.1": {
"content": [
"• IMPROVED: Navigation route calculation timeout increased from 15 to 30 seconds - better success rate for complex routes in dense areas",
"• TECHNICAL: Route timeout is now configurable in dev_config for easier future adjustments"
]
},
"1.6.0": {
"content": [
"• Internal code organization improvements - better separation of concerns for improved maintainability",

View File

@@ -60,6 +60,9 @@ const Duration kChangesetCloseMaxRetryDelay = Duration(minutes: 5); // Cap at 5
const Duration kChangesetAutoCloseTimeout = Duration(minutes: 59); // Give up and trust OSM auto-close
const double kChangesetCloseBackoffMultiplier = 2.0;
// Navigation routing configuration
const Duration kNavigationRoutingTimeout = Duration(seconds: 30); // HTTP timeout for routing requests
// Suspected locations CSV URL
const String kSuspectedLocationsCsvUrl = 'https://alprwatch.org/suspected-locations/deflock-latest.csv';

View File

@@ -5,6 +5,7 @@ import 'package:latlong2/latlong.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../app_state.dart';
import '../dev_config.dart';
class RouteResult {
final List<LatLng> waypoints;
@@ -26,7 +27,6 @@ class RouteResult {
class RoutingService {
static const String _baseUrl = 'https://alprwatch.org/api/v1/deflock/directions';
static const String _userAgent = 'DeFlock/1.0 (OSM surveillance mapping app)';
static const Duration _timeout = Duration(seconds: 15);
// Calculate route between two points using alprwatch
Future<RouteResult> calculateRoute({
@@ -72,7 +72,7 @@ class RoutingService {
'Content-Type': 'application/json'
},
body: json.encode(params)
).timeout(_timeout);
).timeout(kNavigationRoutingTimeout);
if (response.statusCode != 200) {
throw RoutingException('HTTP ${response.statusCode}: ${response.reasonPhrase}');

View File

@@ -1,7 +1,7 @@
name: deflockapp
description: Map public surveillance infrastructure with OpenStreetMap
publish_to: "none"
version: 1.6.0+26 # The thing after the + is the version code, incremented with each release
version: 1.6.1+27 # The thing after the + is the version code, incremented with each release
environment:
sdk: ">=3.5.0 <4.0.0" # oauth2_client 4.x needs Dart 3.5+