Skip to content

feat(server): add PCDN scheduling & dispatch pipeline#8

Open
hequan2017 wants to merge 1 commit intomainfrom
codex/add-pcdn-module-in-server/service
Open

feat(server): add PCDN scheduling & dispatch pipeline#8
hequan2017 wants to merge 1 commit intomainfrom
codex/add-pcdn-module-in-server/service

Conversation

@hequan2017
Copy link
Copy Markdown
Owner

Motivation

  • Provide a PCDN scheduling and delivery pipeline to select edge nodes for content delivery based on region/ISP/real-time metrics and support audit/replay.
  • Implement a simple, extensible scheduler with weighted scoring + constraint filtering and a pluggable dispatch interface to support multiple protocols in the future.
  • Ensure reliable execution with idempotency, timeout/retry and automatic fallback to secondary nodes.

Description

  • Added a new pcdn service module under server/service/pcdn containing scheduler.go, policy_engine.go, dispatcher.go, fallback.go, runtime.go and enter.go implementing scheduling, scoring, abstract dispatch interface with a MockDispatcher, fallback selection and runtime task processing.
  • Introduced the PcdnDispatchTask model in server/model/pcdn/dispatch_task.go to persist Top-N candidates and metrics snapshot, with task_id/trace_id uniqueness and fields for state, timeout and retry (timeout_seconds, retry_count, max_retry, next_retry_unix).
  • Integrated with existing timed task system by adding server/task/pcdn_dispatch.go and registering two second-level timers in server/initialize/timer.go to run dispatch processing and status sync; registered the model for auto-migration in initialize/gorm_biz.go and added PcdnServiceGroup to service/enter.go.
  • Implemented scheduler flow: filter offline/overloaded/disabled/Docker-failed nodes, preselect by region/ISP affinity, compute weighted score via PolicyEngine, return Top-N and persist PcdnDispatchTask; runtime handles dispatching, idempotent state transitions, retry/backoff and fallback.

Testing

  • Formatted modified files with gofmt -w before tests.
  • Ran cd server && timeout 40s go test ./model/pcdn ./service/pcdn ./task -run TestNope -count=1 which completed (packages report [no test files] / exited 0).
  • Ran cd server && timeout 40s go test ./task ./initialize -run TestNope -count=1 where ./task completed (no test files) and ./initialize timed out in the environment (exit 124).
  • Ran targeted go test on ./service/pcdn which returned [no test files] and exited successfully.

Codex Task

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant