Mercurial > gemma
annotate pkg/imports/scheduled.go @ 5227:fa55f403985b new-fwa
Added a comment about the mode.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 12 May 2020 12:38:31 +0200 |
parents | 78ec61acf72e |
children | 5f47eeea988d |
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" |
1551
d9eba69f6515
Registered a dummy callback function for scheduled fairway imports in the scheduler.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 "log" |
2043
58b77f6b8764
Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2042
diff
changeset
|
21 "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
|
22 |
2043
58b77f6b8764
Imports: completed the starting of a scheduled job.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2042
diff
changeset
|
23 "gemma.intevation.de/gemma/pkg/common" |
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 { |
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
|
32 log.Printf("error: 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 } |
1665
da0d1a19ebe6
Fairway availability import: Made schedulable, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1661
diff
changeset
|
35 log.Printf("info: 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 } |