Files
MokoGitea/services/release/tag.go
T
Jonathan Miller c572fcfe04
PR RC Release / Build RC Release (pull_request) Failing after 0s
Branch Policy Check / Verify merge target (pull_request) Failing after 0s
chore(core): rename Go module from code.gitea.io/gitea to MokoGitea namespace
Rename the Go module path from code.gitea.io/gitea to
git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire
codebase.

Scope:
- go.mod module declaration
- 2,235 Go source files (import paths)
- Dockerfile WORKDIR and COPY paths
- Swagger API templates
- golangci.yml linter config

External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea,
gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are
separate upstream modules.

Closes #132

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-25 00:22:38 -05:00

62 lines
1.7 KiB
Go

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package release
import (
"context"
"errors"
"fmt"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/db"
repo_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/repo"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/graceful"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/queue"
repo_module "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/repository"
"xorm.io/builder"
)
type TagSyncOptions struct {
RepoID int64
}
// tagSyncQueue represents a queue to handle tag sync jobs.
var tagSyncQueue *queue.WorkerPoolQueue[*TagSyncOptions]
func handlerTagSync(items ...*TagSyncOptions) []*TagSyncOptions {
for _, opts := range items {
err := repo_module.SyncRepoTags(graceful.GetManager().ShutdownContext(), opts.RepoID)
if err != nil {
log.Error("syncRepoTags [%d] failed: %v", opts.RepoID, err)
}
}
return nil
}
func addRepoToTagSyncQueue(repoID int64) error {
return tagSyncQueue.Push(&TagSyncOptions{
RepoID: repoID,
})
}
func initTagSyncQueue(ctx context.Context) error {
tagSyncQueue = queue.CreateUniqueQueue(ctx, "tag_sync", handlerTagSync)
if tagSyncQueue == nil {
return errors.New("unable to create tag_sync queue")
}
go graceful.GetManager().RunWithCancel(tagSyncQueue)
return nil
}
func AddAllRepoTagsToSyncQueue(ctx context.Context) error {
if err := db.Iterate(ctx, builder.Eq{"is_empty": false}, func(ctx context.Context, repo *repo_model.Repository) error {
return addRepoToTagSyncQueue(repo.ID)
}); err != nil {
return fmt.Errorf("run sync all tags failed: %v", err)
}
return nil
}