0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2,search/management/commands/post_dirty_sounds_to_solr.py,Command,handle,#Command#,37

Before Change



        num_correctly_indexed_sounds = 0
        slice_size = 1000
        for i in range(0, num_sounds, slice_size):
            console_logger.info("Adding %i sounds to solr, slice %i", slice_size, i)
            try:
                // Get all sounds moderated and processed ok that has is_index_dirty
                where = "sound.moderation_state = "OK" AND sound.processing_state = "OK" AND is_index_dirty = true " \
                        "AND sound.id > %s"
                order_by = "sound.id ASC"
                sounds_qs = Sound.objects.bulk_query_solr(where, order_by, slice_size, (i, ))
                add_sounds_to_solr(sounds_qs)
                num_correctly_indexed_sounds += slice_size
            except SolrException as e:
                console_logger.error("failed to add sound batch to solr index, reason: %s", str(e))
                raise

        logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"
                    % num_correctly_indexed_sounds)

        // Remove all those which are not processed or moderated ok and that are still in solr (should not happen)

After Change


        num_correctly_indexed_sounds = add_all_sounds_to_solr(sounds_to_index)

        if num_correctly_indexed_sounds == num_sounds:
            sounds_to_index.update(is_index_dirty=False)

        logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"
                    % num_correctly_indexed_sounds)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: MTG/freesound
Commit Name: 0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2
Time: 2017-11-10
Author: andres.ferraro@upf.edu
File Name: search/management/commands/post_dirty_sounds_to_solr.py
Class Name: Command
Method Name: handle


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: f8d8b3f1a9d8c315977cfbf53785cbbeaf8be94c
Time: 2016-03-10
Author: wonderfly@google.com
File Name: perfkitbenchmarker/publisher.py
Class Name: DefaultMetadataProvider
Method Name: AddMetadata


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 204147309d829f5a1d4ac499acfd7941dad21523
Time: 2016-03-17
Author: wonderfly@google.com
File Name: perfkitbenchmarker/publisher.py
Class Name: DefaultMetadataProvider
Method Name: AddMetadata