Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
368013a5
Commit
368013a5
authored
6 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
initialize job source in one function
parent
9a6cf300
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
importer/fetch.go
+0
-7
0 additions, 7 deletions
importer/fetch.go
importer/job.go
+2
-1
2 additions, 1 deletion
importer/job.go
importer/job_source.go
+8
-5
8 additions, 5 deletions
importer/job_source.go
with
10 additions
and
13 deletions
importer/fetch.go
+
0
−
7
View file @
368013a5
...
...
@@ -39,13 +39,6 @@ type copyResult struct {
func
(
job
*
Job
)
fetch
()
(
interface
{},
error
)
{
job
.
Progress
.
set
(
StepFetching
,
0
)
// wait until source is attached
select
{
case
<-
job
.
ctx
.
Done
()
:
return
nil
,
job
.
ctx
.
Err
()
case
<-
job
.
subC
.
sourceAttached
:
}
// job.source is now initialized and points to a valid source
// make sure a potentially connected source gets notified in any case
defer
job
.
source
.
Done
(
nil
)
...
...
This diff is collapsed.
Click to expand it.
importer/job.go
+
2
−
1
View file @
368013a5
...
...
@@ -82,10 +82,11 @@ func (job *Job) run() error {
job
.
im
.
dbgLog
.
Printf
(
"running import for %s/%d from: %s"
,
job
.
Group
,
job
.
ID
,
job
.
Source
.
String
())
job
.
im
.
store
.
UpdateFileImportState
(
job
.
Group
,
job
.
ID
,
store
.
ImportRunning
)
if
err
:=
job
.
prepar
eSource
();
err
!=
nil
{
if
err
:=
job
.
initializ
eSource
();
err
!=
nil
{
job
.
im
.
store
.
UpdateFileImportState
(
job
.
Group
,
job
.
ID
,
store
.
ImportAborted
)
return
err
}
// job.source is now initialized and points to a valid source
loudness
,
err
:=
job
.
fetch
()
if
err
!=
nil
{
job
.
im
.
store
.
UpdateFileImportState
(
job
.
Group
,
job
.
ID
,
store
.
ImportAborted
)
...
...
This diff is collapsed.
Click to expand it.
importer/job_source.go
+
8
−
5
View file @
368013a5
...
...
@@ -30,9 +30,15 @@ import (
"time"
)
func
(
job
*
Job
)
prepar
eSource
()
error
{
func
(
job
*
Job
)
initializ
eSource
()
error
{
if
job
.
Source
.
Scheme
==
SourceSchemeAttachment
{
// the source will be attached using AttachSource()
// the source will be attached using job.AttachSource() so all we need to do
// is to wait for it to happen
select
{
case
<-
job
.
ctx
.
Done
()
:
return
job
.
ctx
.
Err
()
case
<-
job
.
subC
.
sourceAttached
:
}
return
nil
}
...
...
@@ -41,9 +47,6 @@ func (job *Job) prepareSource() error {
switch
job
.
Source
.
Scheme
{
case
SourceSchemeFlowJS
:
job
.
source
=
newJobSourceFlowJS
(
job
.
Source
)
// TODO: implement other sources
case
SourceSchemeFake
:
job
.
source
=
newJobSourceFake
(
job
.
Source
)
default
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment