Mercurial > gemma
annotate pkg/scheduler/boot.go @ 4550:aa2d0006e742 iso-areas
Write iso lines between classes to SVG for debugging.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 30 Sep 2019 16:34:55 +0200 |
parents | 6691bf76af1c |
children | 5f47eeea988d |
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 = ` |
2614
6691bf76af1c
Booting scheduler: Fixed scheduling import jobs at boot time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2055
diff
changeset
|
29 SELECT c.id, c.kind, a.v |
2053
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 |
2614
6691bf76af1c
Booting scheduler: Fixed scheduling import jobs at boot time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2055
diff
changeset
|
33 WHERE a.k = 'cron' AND a.v IS NOT NULL AND a.v <> '' |
6691bf76af1c
Booting scheduler: Fixed scheduling import jobs at boot time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2055
diff
changeset
|
34 ` |
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
|
35 |
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
|
36 scheduledIDsSQL = ` |
2054
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
37 SELECT id |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
38 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
|
39 WHERE |
c06a2e5397fc
Scheduler: Adjusted booting of scheduled imports to new database schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1995
diff
changeset
|
40 username = $1 |
2054
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
41 AND id IN ( |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
42 SELECT import_configuration_id |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
43 FROM import.import_configuration_attributes |
b03e487117df
Scheduler: Fixed booting SQL statements.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2053
diff
changeset
|
44 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
|
45 ) |
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
|
46 |
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 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
|
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 // 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
|
50 // 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 } |
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 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
|
63 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
|
64 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
|
65 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
|
66 } |
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 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
|
68 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
|
69 } |
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 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
|
71 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
|
72 &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
|
73 &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
|
74 &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
|
75 ); 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
|
76 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
|
77 } |
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
|
78 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
|
79 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
|
80 }) |
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 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
|
82 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
|
83 } |
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 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
|
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 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
|
87 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
|
88 } |
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 } |
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
|
90 |
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
|
91 // 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 ) (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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 } |
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 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 } |
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 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
|
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 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
|
111 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
|
112 } |
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 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
|
114 } |