Exemplo n.º 1
0
    def test_expect_returns_indexed_version_if_exists(self):
        repo_name = '/a/b'
        helpers.save_indexed_version('GH', repo_name, 'wiki', 'xxx')

        cut = helpers.get_indexed_version
        actual = cut('GH', repo_name, 'wiki')

        self.assertEqual(actual, 'xxx')
Exemplo n.º 2
0
def index(gh_type, repo_name, gh_pool, force=False):
    start = time.mktime(datetime.now().timetuple())
    version = helpers.get_version_if_modified(gh_type, repo_name, obj_type, force)
    if not version:
        return
    bulk_data = index_readme(gh_type, repo_name, gh_pool)
    helpers.rebuild_repo_index(gh_type, repo_name, obj_type, bulk_data)
    helpers.save_indexed_version(gh_type, repo_name, obj_type, version)
    end = time.mktime(datetime.now().timetuple())
    print '%s: %s readmes (%s secs)' % (repo_name, len(bulk_data)/2, end-start)
Exemplo n.º 3
0
def index(gh_type, pool, repo_name):
    start = time.mktime(datetime.now().timetuple())
    indexed_timestamp = helpers.get_indexed_version(gh_type, repo_name, obj_type)
    # increment timestamp by one second to prevent duplicates
    indexed_timestamp = nudge_datetime(indexed_timestamp)
    bulk_data = []
    if is_updated_issues(gh_type, pool, repo_name, indexed_timestamp):
        bulk_data, most_recent_timestamp = index_gh_issues(gh_type, pool, repo_name)
        bulk_data += index_gh_issue_comments(gh_type, pool, repo_name)
        helpers.rebuild_repo_index(gh_type, repo_name, obj_type, bulk_data)
        # Update the 'latest version'
        if most_recent_timestamp:
            helpers.save_indexed_version(gh_type, repo_name, obj_type,
                                         most_recent_timestamp)

    end = time.mktime(datetime.now().timetuple())
    print '%s: %s github issues/comments (%s secs)' % (repo_name, len(bulk_data)/2, end-start)
Exemplo n.º 4
0
def index(gh_type, pool, repo_name):
    start = time.mktime(datetime.now().timetuple())
    indexed_timestamp = helpers.get_indexed_version(gh_type, repo_name,
                                                    obj_type)
    # increment timestamp by one second to prevent duplicates
    indexed_timestamp = nudge_datetime(indexed_timestamp)
    bulk_data = []
    if is_updated_issues(gh_type, pool, repo_name, indexed_timestamp):
        bulk_data, most_recent_timestamp = index_gh_issues(
            gh_type, pool, repo_name)
        bulk_data += index_gh_issue_comments(gh_type, pool, repo_name)
        helpers.rebuild_repo_index(gh_type, repo_name, obj_type, bulk_data)
        # Update the 'latest version'
        if most_recent_timestamp:
            helpers.save_indexed_version(gh_type, repo_name, obj_type,
                                         most_recent_timestamp)

    end = time.mktime(datetime.now().timetuple())
    print '%s: %s github issues/comments (%s secs)' % (
        repo_name, len(bulk_data) / 2, end - start)