@@ -68,7 +68,7 @@ func (e RepoRefNotFoundError) Is(err error) bool {
68
68
}
69
69
70
70
// NewRequest creates an archival request, based on the URI. The
71
- // resulting ArchiveRequest is suitable for being passed to ArchiveRepository ()
71
+ // resulting ArchiveRequest is suitable for being passed to Await ()
72
72
// if it's determined that the request still needs to be satisfied.
73
73
func NewRequest (repoID int64 , repo * git.Repository , uri string ) (* ArchiveRequest , error ) {
74
74
r := & ArchiveRequest {
@@ -151,13 +151,14 @@ func (aReq *ArchiveRequest) Await(ctx context.Context) (*repo_model.RepoArchiver
151
151
}
152
152
}
153
153
154
+ // doArchive satisfies the ArchiveRequest being passed in. Processing
155
+ // will occur in a separate goroutine, as this phase may take a while to
156
+ // complete. If the archive already exists, doArchive will not do
157
+ // anything. In all cases, the caller should be examining the *ArchiveRequest
158
+ // being returned for completion, as it may be different than the one they passed
159
+ // in.
154
160
func doArchive (ctx context.Context , r * ArchiveRequest ) (* repo_model.RepoArchiver , error ) {
155
- txCtx , committer , err := db .TxContext (ctx )
156
- if err != nil {
157
- return nil , err
158
- }
159
- defer committer .Close ()
160
- ctx , _ , finished := process .GetManager ().AddContext (txCtx , fmt .Sprintf ("ArchiveRequest[%d]: %s" , r .RepoID , r .GetArchiveName ()))
161
+ ctx , _ , finished := process .GetManager ().AddContext (ctx , fmt .Sprintf ("ArchiveRequest[%d]: %s" , r .RepoID , r .GetArchiveName ()))
161
162
defer finished ()
162
163
163
164
archiver , err := repo_model .GetRepoArchiver (ctx , r .RepoID , r .Type , r .CommitID )
@@ -192,7 +193,7 @@ func doArchive(ctx context.Context, r *ArchiveRequest) (*repo_model.RepoArchiver
192
193
return nil , err
193
194
}
194
195
}
195
- return archiver , committer . Commit ()
196
+ return archiver , nil
196
197
}
197
198
198
199
if ! errors .Is (err , os .ErrNotExist ) {
@@ -261,17 +262,7 @@ func doArchive(ctx context.Context, r *ArchiveRequest) (*repo_model.RepoArchiver
261
262
}
262
263
}
263
264
264
- return archiver , committer .Commit ()
265
- }
266
-
267
- // ArchiveRepository satisfies the ArchiveRequest being passed in. Processing
268
- // will occur in a separate goroutine, as this phase may take a while to
269
- // complete. If the archive already exists, ArchiveRepository will not do
270
- // anything. In all cases, the caller should be examining the *ArchiveRequest
271
- // being returned for completion, as it may be different than the one they passed
272
- // in.
273
- func ArchiveRepository (ctx context.Context , request * ArchiveRequest ) (* repo_model.RepoArchiver , error ) {
274
- return doArchive (ctx , request )
265
+ return archiver , nil
275
266
}
276
267
277
268
var archiverQueue * queue.WorkerPoolQueue [* ArchiveRequest ]
@@ -281,8 +272,10 @@ func Init(ctx context.Context) error {
281
272
handler := func (items ... * ArchiveRequest ) []* ArchiveRequest {
282
273
for _ , archiveReq := range items {
283
274
log .Trace ("ArchiverData Process: %#v" , archiveReq )
284
- if _ , err := doArchive (ctx , archiveReq ); err != nil {
275
+ if archiver , err := doArchive (ctx , archiveReq ); err != nil {
285
276
log .Error ("Archive %v failed: %v" , archiveReq , err )
277
+ } else {
278
+ log .Trace ("ArchiverData Success: %#v" , archiver )
286
279
}
287
280
}
288
281
return nil
0 commit comments