模块命名变更
This commit is contained in:
@@ -7,12 +7,12 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/cache"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/git"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/logger"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/models"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/stats"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/storage"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/cache"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/git"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/logger"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/models"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/stats"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/storage"
|
||||
)
|
||||
|
||||
// CloneHandler 克隆任务处理器
|
||||
@@ -301,7 +301,7 @@ func (h *StatsHandler) Handle(ctx context.Context, task *models.Task) error {
|
||||
if cached != nil {
|
||||
// 缓存命中,直接返回
|
||||
logger.Logger.Info().Str("cache_key", cacheKey).Msg("cache hit during stats calculation")
|
||||
|
||||
|
||||
result := models.TaskResult{
|
||||
CacheKey: cacheKey,
|
||||
Message: "cache hit",
|
||||
@@ -310,7 +310,7 @@ func (h *StatsHandler) Handle(ctx context.Context, task *models.Task) error {
|
||||
resultStr := string(resultJSON)
|
||||
task.Result = &resultStr
|
||||
h.store.Tasks().Update(ctx, task)
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/logger"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/storage"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/logger"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/storage"
|
||||
)
|
||||
|
||||
// Pool Worker池
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/logger"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/models"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/storage"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/logger"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/models"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/storage"
|
||||
)
|
||||
|
||||
// Queue 任务队列
|
||||
@@ -40,7 +40,7 @@ func (q *Queue) Enqueue(ctx context.Context, task *models.Task) error {
|
||||
Int64("repo_id", task.RepoID).
|
||||
Str("task_type", task.TaskType).
|
||||
Msg("task already exists, returning existing task")
|
||||
|
||||
|
||||
task.ID = existing.ID
|
||||
task.Status = existing.Status
|
||||
task.CreatedAt = existing.CreatedAt
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/logger"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/models"
|
||||
"github.com/gitcodestatic/gitcodestatic/internal/storage"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/logger"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/models"
|
||||
"github.com/hanxuanyu/gitcodestatic/internal/storage"
|
||||
)
|
||||
|
||||
// TaskHandler 任务处理器接口
|
||||
@@ -121,7 +121,7 @@ func (w *Worker) handleTask(ctx context.Context, task *models.Task) {
|
||||
|
||||
// 执行任务
|
||||
err := handler.Handle(taskCtx, task)
|
||||
|
||||
|
||||
duration := time.Since(startTime)
|
||||
|
||||
if err != nil {
|
||||
@@ -133,7 +133,7 @@ func (w *Worker) handleTask(ctx context.Context, task *models.Task) {
|
||||
Str("task_type", task.TaskType).
|
||||
Int64("duration_ms", duration.Milliseconds()).
|
||||
Msg("task failed")
|
||||
|
||||
|
||||
w.store.Tasks().UpdateStatus(ctx, task.ID, models.TaskStatusFailed, &errMsg)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user