@@ -10,21 +10,20 @@ import (
1010 repo_model "code.gitea.io/gitea/models/repo"
1111 "code.gitea.io/gitea/modules/graceful"
1212 "code.gitea.io/gitea/modules/log"
13- mirror_module "code.gitea.io/gitea/modules/mirror"
1413 "code.gitea.io/gitea/modules/queue"
1514 "code.gitea.io/gitea/modules/setting"
1615)
1716
1817// doMirrorSync causes this request to mirror itself
19- func doMirrorSync (ctx context.Context , req * mirror_module. SyncRequest ) {
18+ func doMirrorSync (ctx context.Context , req * SyncRequest ) {
2019 if req .ReferenceID == 0 {
2120 log .Warn ("Skipping mirror sync request, no mirror ID was specified" )
2221 return
2322 }
2423 switch req .Type {
25- case mirror_module . PushMirrorType :
24+ case PushMirrorType :
2625 _ = SyncPushMirror (ctx , req .ReferenceID )
27- case mirror_module . PullMirrorType :
26+ case PullMirrorType :
2827 _ = SyncPullMirror (ctx , req .ReferenceID )
2928 default :
3029 log .Error ("Unknown Request type in queue: %v for MirrorID[%d]" , req .Type , req .ReferenceID )
@@ -43,7 +42,7 @@ func Update(ctx context.Context, pullLimit, pushLimit int) error {
4342
4443 handler := func (idx int , bean any ) error {
4544 var repo * repo_model.Repository
46- var mirrorType mirror_module. SyncType
45+ var mirrorType SyncType
4746 var referenceID int64
4847
4948 if m , ok := bean .(* repo_model.Mirror ); ok {
@@ -52,15 +51,15 @@ func Update(ctx context.Context, pullLimit, pushLimit int) error {
5251 return nil
5352 }
5453 repo = m .Repo
55- mirrorType = mirror_module . PullMirrorType
54+ mirrorType = PullMirrorType
5655 referenceID = m .RepoID
5756 } else if m , ok := bean .(* repo_model.PushMirror ); ok {
5857 if m .GetRepository () == nil {
5958 log .Error ("Disconnected push-mirror found: %d" , m .ID )
6059 return nil
6160 }
6261 repo = m .Repo
63- mirrorType = mirror_module . PushMirrorType
62+ mirrorType = PushMirrorType
6463 referenceID = m .ID
6564 } else {
6665 log .Error ("Unknown bean: %v" , bean )
@@ -75,9 +74,9 @@ func Update(ctx context.Context, pullLimit, pushLimit int) error {
7574 }
7675
7776 // Push to the Queue
78- if err := mirror_module . PushToQueue (mirrorType , referenceID ); err != nil {
77+ if err := PushToQueue (mirrorType , referenceID ); err != nil {
7978 if err == queue .ErrAlreadyInQueue {
80- if mirrorType == mirror_module . PushMirrorType {
79+ if mirrorType == PushMirrorType {
8180 log .Trace ("PushMirrors for %-v already queued for sync" , repo )
8281 } else {
8382 log .Trace ("PullMirrors for %-v already queued for sync" , repo )
@@ -120,7 +119,7 @@ func Update(ctx context.Context, pullLimit, pushLimit int) error {
120119 return nil
121120}
122121
123- func queueHandler (items ... * mirror_module. SyncRequest ) []* mirror_module. SyncRequest {
122+ func queueHandler (items ... * SyncRequest ) []* SyncRequest {
124123 for _ , req := range items {
125124 doMirrorSync (graceful .GetManager ().ShutdownContext (), req )
126125 }
@@ -129,5 +128,5 @@ func queueHandler(items ...*mirror_module.SyncRequest) []*mirror_module.SyncRequ
129128
130129// InitSyncMirrors initializes a go routine to sync the mirrors
131130func InitSyncMirrors () {
132- mirror_module . StartSyncMirrors (queueHandler )
131+ StartSyncMirrors (queueHandler )
133132}
0 commit comments