mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
make sure we're only writing the config once; fix speed regressions in browser
This commit is contained in:
parent
2e327f4fe9
commit
8e7ed0acc9
2 changed files with 6 additions and 4 deletions
|
@ -98,12 +98,14 @@ class Config(object):
|
|||
self.db.executescript("""
|
||||
create table if not exists decks (path text primary key);
|
||||
create table if not exists config (conf text not null);
|
||||
insert or ignore into config values ('');""")
|
||||
""")
|
||||
conf = self.db.scalar("select conf from config")
|
||||
if conf:
|
||||
self._conf.update(cPickle.loads(conf))
|
||||
else:
|
||||
self._conf.update(defaultConf)
|
||||
# ensure there's something to update
|
||||
self.db.execute("insert or ignore into config values ('')")
|
||||
self._addDefaults()
|
||||
|
||||
def save(self):
|
||||
|
|
|
@ -19,7 +19,7 @@ hr { margin: 5 0 5 0; }
|
|||
a:hover { background-color: #aaa; }
|
||||
a { color: #000; text-decoration: none; }
|
||||
.num { text-align: right; padding: 0 5 0 5; }
|
||||
td.opts { text-align: right; }
|
||||
td.opts { text-align: right; white-space: nowrap; }
|
||||
a.opts { font-size: 80%; padding: 2; background-color: #ccc; border-radius: 2px; }
|
||||
"""
|
||||
|
||||
|
@ -236,7 +236,7 @@ later by using File>Close.
|
|||
try:
|
||||
mod = os.stat(d)[stat.ST_MTIME]
|
||||
t = time.time()
|
||||
deck = Deck(d)
|
||||
deck = Deck(d, lock=False)
|
||||
counts = deck.sched.counts()
|
||||
dtime = deck.sched.timeToday()
|
||||
dreps = deck.sched.repsToday()
|
||||
|
@ -251,7 +251,7 @@ later by using File>Close.
|
|||
'time': dtime,
|
||||
'reps': dreps
|
||||
})
|
||||
deck.close()
|
||||
deck.close(save=False)
|
||||
# reset modification time for the sake of backup systems
|
||||
try:
|
||||
os.utime(d, (mod, mod))
|
||||
|
|
Loading…
Reference in a new issue