OLD | NEW |
1 # This file is part of Buildbot. Buildbot is free software: you can | 1 # This file is part of Buildbot. Buildbot is free software: you can |
2 # redistribute it and/or modify it under the terms of the GNU General Public | 2 # redistribute it and/or modify it under the terms of the GNU General Public |
3 # License as published by the Free Software Foundation, version 2. | 3 # License as published by the Free Software Foundation, version 2. |
4 # | 4 # |
5 # This program is distributed in the hope that it will be useful, but WITHOUT | 5 # This program is distributed in the hope that it will be useful, but WITHOUT |
6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
8 # details. | 8 # details. |
9 # | 9 # |
10 # You should have received a copy of the GNU General Public License along with | 10 # You should have received a copy of the GNU General Public License along with |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 u.database = u.database % dict(basedir = kwargs['basedir']) | 76 u.database = u.database % dict(basedir = kwargs['basedir']) |
77 if not os.path.isabs(u.database[0]): | 77 if not os.path.isabs(u.database[0]): |
78 u.database = os.path.join(kwargs['basedir'], u.database) | 78 u.database = os.path.join(kwargs['basedir'], u.database) |
79 | 79 |
80 # in-memory databases need exactly one connection | 80 # in-memory databases need exactly one connection |
81 if not u.database: | 81 if not u.database: |
82 kwargs['pool_size'] = 1 | 82 kwargs['pool_size'] = 1 |
83 max_conns = 1 | 83 max_conns = 1 |
84 | 84 |
| 85 # allow serializing access to the db |
| 86 if 'serialize_access' in u.query: |
| 87 u.query.pop('serialize_access') |
| 88 max_conns = 1 |
| 89 |
85 return u, kwargs, max_conns | 90 return u, kwargs, max_conns |
86 | 91 |
87 def set_up_sqlite_engine(self, u, engine): | 92 def set_up_sqlite_engine(self, u, engine): |
88 """Special setup for sqlite engines""" | 93 """Special setup for sqlite engines""" |
89 # try to enable WAL logging | 94 # try to enable WAL logging |
90 if u.database: | 95 if u.database: |
91 log.msg("setting database journal mode to 'wal'") | 96 log.msg("setting database journal mode to 'wal'") |
92 try: | 97 try: |
93 engine.execute("pragma journal_mode = wal") | 98 engine.execute("pragma journal_mode = wal") |
94 except: | 99 except: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 174 |
170 BuildbotEngineStrategy() | 175 BuildbotEngineStrategy() |
171 | 176 |
172 # this module is really imported for the side-effects, but pyflakes will like | 177 # this module is really imported for the side-effects, but pyflakes will like |
173 # us to use something from the module -- so offer a copy of create_engine, which | 178 # us to use something from the module -- so offer a copy of create_engine, which |
174 # explicitly adds the strategy argument | 179 # explicitly adds the strategy argument |
175 def create_engine(*args, **kwargs): | 180 def create_engine(*args, **kwargs): |
176 kwargs['strategy'] = 'buildbot' | 181 kwargs['strategy'] = 'buildbot' |
177 | 182 |
178 return sqlalchemy.create_engine(*args, **kwargs) | 183 return sqlalchemy.create_engine(*args, **kwargs) |
OLD | NEW |