Flutter Engine
The Flutter Engine
get_uninteresting_hashes.py
Go to the documentation of this file.
1# Copyright 2024 Google LLC
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import contextlib
7import math
8import socket
9import sys
10import time
11
12from urllib.request import urlopen
13
14HASHES_URL = sys.argv[1]
15RETRIES = 5
16TIMEOUT = 60
17WAIT_BASE = 15
18
19socket.setdefaulttimeout(TIMEOUT)
20for retry in range(RETRIES):
21 try:
22 with contextlib.closing(
23 urlopen(HASHES_URL, timeout=TIMEOUT)) as w:
24 hashes = w.read().decode('utf-8')
25 with open(sys.argv[2], 'w') as f:
26 f.write(hashes)
27 break
28 except Exception as e:
29 print('Failed to get uninteresting hashes from %s:' % HASHES_URL)
30 print(e)
31 if retry == RETRIES:
32 raise
33 waittime = WAIT_BASE * math.pow(2, retry)
34 print('Retry in %d seconds.' % waittime)
35 time.sleep(waittime)
def print(*args, **kwargs)
Definition: run_tests.py:49
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124