fix updateFlags finishing sequence

master
Vitaliy Filippov 2016-07-25 14:38:15 +03:00
parent a0bb2f2fae
commit 18a086793f
1 changed files with 1 additions and 4 deletions

View File

@ -156,10 +156,7 @@ Syncer.runFetch = function*(what, params, boxId, processor)
function checkFinish() function checkFinish()
{ {
if (self.parsed <= 0 && wait) if (self.parsed <= 0 && wait)
{
wait = false;
cb(); cb();
}
} }
}; };
@ -244,7 +241,7 @@ Syncer.updateFlags = function*(messages, boxId)
flags: toPgArray(m[0].flags) flags: toPgArray(m[0].flags)
})); }));
// TODO check if something is missing // TODO check if something is missing
pg.update('messages m', { flags: pg.sql('t.flags::varchar(255)[]') }) yield pg.update('messages m', { flags: pg.sql('t.flags::varchar(255)[]') })
.from('('+pg.sql.values(rows)+') AS t (uid, flags)') .from('('+pg.sql.values(rows)+') AS t (uid, flags)')
.where({ 'm.folder_id': boxId }).where(pg.sql('m.uid=t.uid')).run(gen.ef()); .where({ 'm.folder_id': boxId }).where(pg.sql('m.uid=t.uid')).run(gen.ef());
self.synced += messages.length; self.synced += messages.length;