Mercurial > gemma
annotate pkg/scheduler/boot.go @ 2294:b2de7a77b570
import soundingresult: fix URL
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 18 Feb 2019 11:11:12 +0100 |
parents | 6594903a14e8 |
children | 6691bf76af1c |
rev | line source |
---|---|
1557
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2018 by via donau |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package scheduler |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 "context" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 "database/sql" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 "log" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 "gemma.intevation.de/gemma/pkg/auth" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 "gemma.intevation.de/gemma/pkg/config" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 ) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 const ( |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 bootRole = "sys_admin" |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 selectImportConfSQL = ` |
2053
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
29 SELECT c.id, username, a.v |
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
30 FROM import.import_configuration c |
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
31 JOIN import.import_configuration_attributes a |
2055
6594903a14e8
Scheduler: Fixed SQL statement once again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2054
diff
changeset
|
32 ON c.id = a.import_configuration_id |
2054
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
33 WHERE c.id IN ( |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
34 SELECT import_configuration_id |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
35 FROM import.import_configuration_attributes |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
36 WHERE k = 'cron')` |
1660
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
37 |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
38 scheduledIDsSQL = ` |
2054
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
39 SELECT id |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
40 FROM import.import_configuration |
2053
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
41 WHERE |
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
42 username = $1 |
2054
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
43 AND id IN ( |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
44 SELECT import_configuration_id |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
45 FROM import.import_configuration_attributes |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
46 WHERE k = 'cron')` |
1557
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 ) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 func init() { go boot() } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 // boot starts the scheduler with the configurations from |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 // the database which have a schedule. |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 func boot() { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 config.WaitReady() |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 log.Println("info: booting scheduler from database.") |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 ctx := context.Background() |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 err := auth.RunAs( |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 ctx, bootRole, |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 func(conn *sql.Conn) error { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 rows, err := conn.QueryContext(ctx, selectImportConfSQL) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 if err != nil { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 return err |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 defer rows.Close() |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 err = BootActions(func(ba *BoundAction) (bool, error) { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 if err != nil { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 return false, err |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 if !rows.Next() { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 return false, nil |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 var id int64 |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 if err = rows.Scan( |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 &id, |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 &ba.Name, |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 &ba.Spec, |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 ); err != nil { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 return false, err |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 } |
1652
f39957ea08aa
Scheduled imports: The configuration id is not optional as it used to load the concrete configuration from the database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1557
diff
changeset
|
80 ba.CfgID = id |
1557
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 return true, nil |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 }) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 if err != nil { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 return err |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 return rows.Err() |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 }) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 if err != nil { |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 log.Printf("error: %v\n", err) |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 } |
62171cd9a42b
Import scheduler: Start scheduler a gemma boot time with configurations from database which have a schedule.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 } |
1660
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
92 |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
93 // ScheduledUserIDs returns the IDs with a schedule for a given user. |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
94 func ScheduledUserIDs( |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
95 ctx context.Context, |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
96 conn *sql.Conn, |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
97 user string, |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
98 ) (map[int64]struct{}, error) { |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
99 ids := map[int64]struct{}{} |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
100 rows, err := conn.QueryContext(ctx, scheduledIDsSQL, user) |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
101 if err != nil { |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
102 return nil, nil |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
103 } |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
104 defer rows.Close() |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
105 for rows.Next() { |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
106 var id int64 |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
107 if err := rows.Scan(&id); err != nil { |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
108 return nil, err |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
109 } |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
110 ids[id] = struct{}{} |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
111 } |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
112 if err := rows.Err(); err != nil { |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
113 return nil, err |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
114 } |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
115 return ids, nil |
f32e8a973b48
Scheduler: Moved code to figure out the scheduled jobs per user from the database to a more suited place.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1654
diff
changeset
|
116 } |