annotate pkg/imports/scheduled.go @ 5591:0011f50cf216 surveysperbottleneckid

Removed no longer used alternative api for surveys/ endpoint. As bottlenecks in the summary for SR imports are now identified by their id and no longer by the (not guarantied to be unique!) name, there is no longer the need to request survey data by the name+date tuple (which isn't reliable anyway). So the workaround was now reversed.
author Sascha Wilde <wilde@sha-bang.de>
date Wed, 06 Apr 2022 13:30:29 +0200
parents 5f47eeea988d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1551
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 // This is Free Software under GNU Affero General Public License v >= 3.0
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2 // without warranty, see README.md and license for details.
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 //
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 // SPDX-License-Identifier: AGPL-3.0-or-later
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 // License-Filename: LICENSES/AGPL-3.0.txt
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 //
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 // Copyright (C) 2018 by via donau
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 // – Österreichische Wasserstraßen-Gesellschaft mbH
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 // Software engineering by Intevation GmbH
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 //
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 // Author(s):
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 package imports
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 import (
1748
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
17 "context"
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
18 "database/sql"
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
19 "fmt"
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
20 "time"
1551
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
22 "gemma.intevation.de/gemma/pkg/common"
5490
5f47eeea988d Use own logging package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4152
diff changeset
23 "gemma.intevation.de/gemma/pkg/log"
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
24 "gemma.intevation.de/gemma/pkg/models"
1551
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 "gemma.intevation.de/gemma/pkg/scheduler"
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 )
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
28 func init() {
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
29 run := func(cfgID int64) {
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
30 jobID, err := RunConfiguredImport(cfgID)
1665
da0d1a19ebe6 Fairway availability import: Made schedulable, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1661
diff changeset
31 if err != nil {
5490
5f47eeea988d Use own logging package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4152
diff changeset
32 log.Errorf("running scheduled import failed: %v\n", err)
1705
dcbe2a7dc532 Scheduled imports: Take extra configuration parameters from attributes table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1678
diff changeset
33 return
dcbe2a7dc532 Scheduled imports: Take extra configuration parameters from attributes table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1678
diff changeset
34 }
5490
5f47eeea988d Use own logging package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4152
diff changeset
35 log.Infof("added import #%d to queue\n", jobID)
1661
51a0ba4ede41 Scheduled imports: Made gauge measurement import able to be scheduled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1654
diff changeset
36 }
51a0ba4ede41 Scheduled imports: Made gauge measurement import able to be scheduled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1654
diff changeset
37
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
38 for kind := range kindToImportModel {
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
39 scheduler.RegisterAction(string(kind), run)
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
40 }
1551
d9eba69f6515 Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
42
1748
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
43 // RunConfiguredImportContext runs an import configured from the database.
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
44 func RunConfiguredImportContext(ctx context.Context, conn *sql.Conn, id int64) (int64, error) {
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
45 cfg, err := LoadPersistentConfigContext(ctx, conn, id)
1748
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
46 return runConfiguredImport(id, cfg, err)
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
47 }
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
48
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
49 // RunConfiguredImport runs an import configured from the database.
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
50 func RunConfiguredImport(id int64) (int64, error) {
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
51 cfg, err := loadPersistentConfig(id)
1748
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
52 return runConfiguredImport(id, cfg, err)
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
53 }
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
54
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
55 func runConfiguredImport(id int64, cfg *PersistentConfig, err error) (int64, error) {
1748
c11807dc6940 Comfigured imports: Run enqueing of configured imports if triggered by REST with the database connection of the logged in user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1746
diff changeset
56
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
57 if err != nil {
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
58 return 0, err
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
59 }
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
60 if cfg == nil {
4152
78ec61acf72e Made 'golint' happier with imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2047
diff changeset
61 return 0, fmt.Errorf("no config found for id %d", id)
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
62 }
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
63
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
64 kind := JobKind(cfg.Kind)
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
65
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
66 ctor := ImportModelForJobKind(kind)
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
67 if ctor == nil {
4152
78ec61acf72e Made 'golint' happier with imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2047
diff changeset
68 return 0, fmt.Errorf("no constructor for kind '%s'", cfg.Kind)
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
69 }
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
70
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
71 what := ctor()
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
72
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
73 // Fill the data structure
2047
78002c5e838c Imports: Code simplification.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2044
diff changeset
74 if err := cfg.Attributes.Unmarshal(what); err != nil {
78002c5e838c Imports: Code simplification.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2044
diff changeset
75 return 0, err
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
76 }
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
77
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
78 converted := ConvertToInternal(kind, what)
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
79 if converted == nil {
4152
78ec61acf72e Made 'golint' happier with imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2047
diff changeset
80 return 0, fmt.Errorf("conversion of model for kind '%s' failed", kind)
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
81 }
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
82
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
83 var serialized string
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
84 if serialized, err = common.ToJSONString(converted); err != nil {
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
85 return 0, err
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
86 }
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
87
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
88 // Extract the job runtime parameters.
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
89 var (
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
90 email bool
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
91 due time.Time
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
92 trys *int
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
93 waitRetry *time.Duration
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
94 )
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
95
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
96 if gqc, ok := what.(models.QueueConfigurationGetter); ok {
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
97 qc := gqc.GetQueueConfiguration()
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
98 if qc.Due != nil {
2044
ea0b62b7656b Imports: Unified JSON marshaling of times and durations in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2043
diff changeset
99 due = qc.Due.Time
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
100 }
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
101 trys = qc.Trys
2044
ea0b62b7656b Imports: Unified JSON marshaling of times and durations in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2043
diff changeset
102 if qc.WaitRetry != nil {
ea0b62b7656b Imports: Unified JSON marshaling of times and durations in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2043
diff changeset
103 waitRetry = &qc.WaitRetry.Duration
ea0b62b7656b Imports: Unified JSON marshaling of times and durations in imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2043
diff changeset
104 }
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
105 }
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
106
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1985
diff changeset
107 if ge, ok := what.(models.EmailTypeGetter); ok {
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
108 email = ge.GetEmailType().Email
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
109 }
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
110
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
111 var jobID int64
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
112 if jobID, err = AddJob(
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
113 kind,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
114 due,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
115 trys,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
116 waitRetry,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
117 cfg.User,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
118 email,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
119 serialized,
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
120 ); err != nil {
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
121 return 0, err
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
122 }
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
123
2043
58b77f6b8764 Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
124 return jobID, nil
1729
74f7d4c531bc Scheduled imports: Refactored calling of database configured import to be reusable elsewhere.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1708
diff changeset
125 }