Browse Source
Fix Maintenance Task Sorting and Refactor Log Persistence (#8199)
Fix Maintenance Task Sorting and Refactor Log Persistence (#8199)
* fix float stepping * do not auto refresh * only logs when non 200 status * fix maintenance task sorting and cleanup redundant handler logic * Refactor log retrieval to persist to disk and fix slowness - Move log retrieval to disk-based persistence in GetMaintenanceTaskDetail - Implement background log fetching on task completion in worker_grpc_server.go - Implement async background refresh for in-progress tasks - Completely remove blocking gRPC calls from the UI path to fix 10s timeouts - Cleanup debug logs and performance profiling code * Ensure consistent deterministic sorting in config_persistence cleanup * Replace magic numbers with constants and remove debug logs - Added descriptive constants for truncation limits and timeouts in admin_server.go and worker_grpc_server.go - Replaced magic numbers with these constants throughout the codebase - Verified removal of stdout debug printing - Ensured consistent truncation logic during log persistence * Address code review feedback on history truncation and logging logic - Fix AssignmentHistory double-serialization by copying task in GetMaintenanceTaskDetail - Fix handleTaskCompletion logging logic (mutually exclusive success/failure logs) - Remove unused Timeout field from LogRequestContext and sync select timeouts with constants - Ensure AssignmentHistory is only provided in the top-level field for better JSON structure * Implement goroutine leak protection and request deduplication - Add request deduplication in RequestTaskLogs to prevent multiple concurrent fetches for the same task - Implement safe cleanup in timeout handlers to avoid race conditions in pendingLogRequests map - Add a 10s cooldown for background log refreshes in GetMaintenanceTaskDetail to prevent spamming - Ensure all persistent log-fetching goroutines are bounded and efficiently managed * Fix potential nil pointer panics in maintenance handlers - Add nil checks for adminServer in ShowTaskDetail, ShowMaintenanceWorkers, and UpdateTaskConfig - Update getMaintenanceQueueData to return a descriptive error instead of nil when adminServer is uninitialized - Ensure internal helper methods consistently check for adminServer initialization before use * Strictly enforce disk-only log reading - Remove background log fetching from GetMaintenanceTaskDetail to prevent timeouts and network calls during page view - Remove unused lastLogFetch tracking fields to clean up dead code - Ensure logs are only updated upon task completion via handleTaskCompletion * Refactor GetWorkerLogs to read from disk - Update /api/maintenance/workers/:id/logs endpoint to use configPersistence.LoadTaskExecutionLogs - Remove synchronous gRPC call RequestTaskLogs to prevent timeouts and bad gateway errors - Ensure consistent log retrieval behavior across the application (disk-only) * Fix timestamp parsing in log viewer - Update task_detail.templ JS to handle both ISO 8601 strings and Unix timestamps - Fix "Invalid time value" error when displaying logs fetched from disk - Regenerate templates * master: fallback to HDD if SSD volumes are full in Assign * worker: improve EC detection logging and fix skip counters * worker: add Sync method to TaskLogger interface * worker: implement Sync and ensure logs are flushed before task completion * admin: improve task log retrieval with retries and better timeouts * admin: robust timestamp parsing in task detail viewpull/8208/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
51 changed files with 498 additions and 240 deletions
-
241weed/admin/dash/admin_server.go
-
31weed/admin/dash/config_persistence.go
-
147weed/admin/dash/worker_grpc_server.go
-
76weed/admin/handlers/maintenance_handlers.go
-
34weed/admin/maintenance/maintenance_queue.go
-
2weed/admin/view/app/admin_templ.go
-
2weed/admin/view/app/cluster_brokers_templ.go
-
2weed/admin/view/app/cluster_collections_templ.go
-
2weed/admin/view/app/cluster_ec_shards_templ.go
-
2weed/admin/view/app/cluster_ec_volumes_templ.go
-
2weed/admin/view/app/cluster_filers_templ.go
-
2weed/admin/view/app/cluster_masters_templ.go
-
2weed/admin/view/app/cluster_volume_servers_templ.go
-
2weed/admin/view/app/cluster_volumes_templ.go
-
2weed/admin/view/app/collection_details_templ.go
-
2weed/admin/view/app/ec_volume_details_templ.go
-
2weed/admin/view/app/file_browser_templ.go
-
2weed/admin/view/app/iceberg_catalog_templ.go
-
2weed/admin/view/app/iceberg_namespaces_templ.go
-
2weed/admin/view/app/iceberg_tables_templ.go
-
2weed/admin/view/app/maintenance_config_schema_templ.go
-
2weed/admin/view/app/maintenance_config_templ.go
-
7weed/admin/view/app/maintenance_queue.templ
-
8weed/admin/view/app/maintenance_queue_templ.go
-
2weed/admin/view/app/maintenance_workers_templ.go
-
2weed/admin/view/app/object_store_users_templ.go
-
2weed/admin/view/app/policies_templ.go
-
2weed/admin/view/app/s3_buckets_templ.go
-
2weed/admin/view/app/s3tables_buckets_templ.go
-
2weed/admin/view/app/s3tables_namespaces_templ.go
-
2weed/admin/view/app/s3tables_tables_templ.go
-
2weed/admin/view/app/service_accounts_templ.go
-
2weed/admin/view/app/subscribers_templ.go
-
2weed/admin/view/app/task_config_schema.templ
-
4weed/admin/view/app/task_config_schema_templ.go
-
2weed/admin/view/app/task_config_templ.go
-
2weed/admin/view/app/task_config_templ_templ.go
-
47weed/admin/view/app/task_detail.templ
-
4weed/admin/view/app/task_detail_templ.go
-
2weed/admin/view/app/topic_details_templ.go
-
2weed/admin/view/app/topics_templ.go
-
2weed/admin/view/app/volume_details_templ.go
-
2weed/admin/view/components/config_sections_templ.go
-
2weed/admin/view/components/form_fields_templ.go
-
2weed/admin/view/layout/layout_templ.go
-
15weed/command/admin.go
-
10weed/server/master_grpc_server_assign.go
-
16weed/worker/tasks/erasure_coding/detection.go
-
17weed/worker/tasks/task_logger.go
-
1weed/worker/types/typed_task_interface.go
-
10weed/worker/worker.go
4
weed/admin/view/app/task_detail_templ.go
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue