@@ -68,7 +68,7 @@ func (e RepoRefNotFoundError) Is(err error) bool {
6868}
6969
7070// 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 () 
7272// if it's determined that the request still needs to be satisfied. 
7373func  NewRequest (repoID  int64 , repo  * git.Repository , uri  string ) (* ArchiveRequest , error ) {
7474	r  :=  & ArchiveRequest {
@@ -151,13 +151,14 @@ func (aReq *ArchiveRequest) Await(ctx context.Context) (*repo_model.RepoArchiver
151151	}
152152}
153153
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. 
154160func  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 ()))
161162	defer  finished ()
162163
163164	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
192193				return  nil , err 
193194			}
194195		}
195- 		return  archiver , committer . Commit () 
196+ 		return  archiver , nil 
196197	}
197198
198199	if  ! errors .Is (err , os .ErrNotExist ) {
@@ -261,17 +262,7 @@ func doArchive(ctx context.Context, r *ArchiveRequest) (*repo_model.RepoArchiver
261262		}
262263	}
263264
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 
275266}
276267
277268var  archiverQueue  * queue.WorkerPoolQueue [* ArchiveRequest ]
@@ -281,8 +272,10 @@ func Init(ctx context.Context) error {
281272	handler  :=  func (items  ... * ArchiveRequest ) []* ArchiveRequest  {
282273		for  _ , archiveReq  :=  range  items  {
283274			log .Trace ("ArchiverData Process: %#v" , archiveReq )
284- 			if  _ , err  :=  doArchive (ctx , archiveReq ); err  !=  nil  {
275+ 			if  archiver , err  :=  doArchive (ctx , archiveReq ); err  !=  nil  {
285276				log .Error ("Archive %v failed: %v" , archiveReq , err )
277+ 			} else  {
278+ 				log .Trace ("ArchiverData Success: %#v" , archiver )
286279			}
287280		}
288281		return  nil 
0 commit comments