mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
filter before sorting
This commit is contained in:
parent
c31d2648cd
commit
e02972f610
1 changed files with 5 additions and 6 deletions
11
archreposrv
11
archreposrv
|
@ -7,6 +7,7 @@ import re
|
|||
import pwd
|
||||
import configparser
|
||||
from functools import partial
|
||||
from itertools import filterfalse
|
||||
import queue
|
||||
import logging
|
||||
import sqlite3
|
||||
|
@ -159,13 +160,11 @@ class EventHandler(pyinotify.ProcessEvent):
|
|||
def _initial_update(self, files):
|
||||
oldfiles = {f[0] for f in self._db.execute('select filename from pkginfo')}
|
||||
|
||||
for f in sorted(files - oldfiles, key=pkgsortkey):
|
||||
if not filterPkg(f):
|
||||
self.dispatch(f, 'add')
|
||||
for f in sorted(filterfalse(filterPkg, files - oldfiles), key=pkgsortkey):
|
||||
self.dispatch(f, 'add')
|
||||
|
||||
for f in sorted(oldfiles - files, key=pkgsortkey):
|
||||
if not filterPkg(f):
|
||||
self.dispatch(f, 'remove')
|
||||
for f in sorted(filterfalse(filterPkg, oldfiles - files), key=pkgsortkey):
|
||||
self.dispatch(f, 'remove')
|
||||
|
||||
def process_IN_CLOSE_WRITE(self, event):
|
||||
logging.debug('Writing done: %s', event.pathname)
|
||||
|
|
Loading…
Add table
Reference in a new issue