mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:51:59 +01:00
Fixed progressbar for reindex
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
817df3c172
commit
9360b429ce
@ -75,12 +75,10 @@ uint64 get_max_meta_id(struct session_data *sdata){
|
|||||||
|
|
||||||
uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct data *data, uint64 from_id, uint64 to_id, struct config *cfg){
|
uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct data *data, uint64 from_id, uint64 to_id, struct config *cfg){
|
||||||
char s[SMALLBUFSIZE];
|
char s[SMALLBUFSIZE];
|
||||||
uint64 stored_id=0, reindexed=0, delta;
|
uint64 stored_id=0, reindexed=0;
|
||||||
struct parser_state state;
|
struct parser_state state;
|
||||||
struct sql sql;
|
struct sql sql;
|
||||||
|
|
||||||
delta = to_id - from_id;
|
|
||||||
|
|
||||||
if(cfg->enable_folders == 1)
|
if(cfg->enable_folders == 1)
|
||||||
snprintf(s, sizeof(s)-1, "SELECT m.`id`, `piler_id`, `arrived`, `sent`, f.folder_id FROM %s m, %s f WHERE m.id=f.id AND (m.id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, SQL_FOLDER_MESSAGE_TABLE, from_id, to_id);
|
snprintf(s, sizeof(s)-1, "SELECT m.`id`, `piler_id`, `arrived`, `sent`, f.folder_id FROM %s m, %s f WHERE m.id=f.id AND (m.id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, SQL_FOLDER_MESSAGE_TABLE, from_id, to_id);
|
||||||
else
|
else
|
||||||
@ -137,6 +135,9 @@ uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct data *da
|
|||||||
unlink(filename);
|
unlink(filename);
|
||||||
|
|
||||||
if(progressbar){
|
if(progressbar){
|
||||||
|
uint64 delta = to_id - from_id;
|
||||||
|
if(delta == 0) delta = 1;
|
||||||
|
|
||||||
printf("processed: %8llu [%3d%%]\r", reindexed, (int)(100*reindexed/delta));
|
printf("processed: %8llu [%3d%%]\r", reindexed, (int)(100*reindexed/delta));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user