diff options
author | Thomas White <taw@physics.org> | 2021-02-19 11:29:08 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-02-19 11:29:08 +0100 |
commit | c967e898771711498964016a93f2530ba0e0dbe9 (patch) | |
tree | 3874327f09a0e7b9b7ed1ed5bf37a967402f8c5c /src/gui_project.c | |
parent | df4b2e604dc0984879e2f417ca5ae1ab7066f539 (diff) |
GUI: Don't re-scan streams so often
It only makes sense to re-scan if there is a job running, but this also
adds a manual re-scan button for rare exceptions.
Diffstat (limited to 'src/gui_project.c')
-rw-r--r-- | src/gui_project.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gui_project.c b/src/gui_project.c index abc80276..29d4ceb3 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -1230,17 +1230,12 @@ struct gui_merge_result *find_merge_result_by_name(struct crystfelproject *proj, } -static void update_result_index(struct gui_indexing_result *result) +void update_result_index(struct gui_indexing_result *result) { int i; - for ( i=0; i<result->n_streams; i++ ) { - - /* FIXME: Skip if already up to date */ - stream_index_free(result->indices[i]); result->indices[i] = stream_make_index(result->streams[i]); - } } @@ -1259,10 +1254,17 @@ struct gui_indexing_result *find_indexing_result_by_name(struct crystfelproject } +static int ever_scanned(struct gui_indexing_result *result) +{ + return ( result->indices[0] != NULL ); +} + + struct image *find_indexed_image(struct crystfelproject *proj, const char *results_name, const char *filename, - const char *event) + const char *event, + int permit_rescan) { Stream *st; int i; @@ -1284,7 +1286,8 @@ struct image *find_indexed_image(struct crystfelproject *proj, } } - if ( !found ) { + if ( !found && (permit_rescan || !ever_scanned(result)) ) { + /* Re-scan and try again */ update_result_index(result); for ( i=0; i<result->n_streams; i++ ) { if ( stream_select_chunk(NULL, |