summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/hashserv/server.py')
-rw-r--r--bitbake/lib/hashserv/server.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py
index 2770c23607..9ade988e56 100644
--- a/bitbake/lib/hashserv/server.py
+++ b/bitbake/lib/hashserv/server.py
@@ -130,6 +130,18 @@ async def copy_from_upstream(client, db, method, taskhash):
130 d = {k: v for k, v in d.items() if k in TABLE_COLUMNS} 130 d = {k: v for k, v in d.items() if k in TABLE_COLUMNS}
131 keys = sorted(d.keys()) 131 keys = sorted(d.keys())
132 132
133 with closing(db.cursor()) as cursor:
134 insert_task(cursor, d)
135 db.commit()
136
137 return d
138
139async def copy_outhash_from_upstream(client, db, method, outhash, taskhash):
140 d = await client.get_outhash(method, outhash, taskhash)
141 if d is not None:
142 # Filter out unknown columns
143 d = {k: v for k, v in d.items() if k in TABLE_COLUMNS}
144 keys = sorted(d.keys())
133 145
134 with closing(db.cursor()) as cursor: 146 with closing(db.cursor()) as cursor:
135 insert_task(cursor, d) 147 insert_task(cursor, d)
@@ -359,6 +371,14 @@ class ServerClient(object):
359 371
360 row = cursor.fetchone() 372 row = cursor.fetchone()
361 373
374 if row is None and self.upstream_client:
375 # Try upstream
376 row = await copy_outhash_from_upstream(self.upstream_client,
377 self.db,
378 data['method'],
379 data['outhash'],
380 data['taskhash'])
381
362 # If no matching outhash was found, or one *was* found but it 382 # If no matching outhash was found, or one *was* found but it
363 # wasn't an exact match on the taskhash, a new entry for this 383 # wasn't an exact match on the taskhash, a new entry for this
364 # taskhash should be added 384 # taskhash should be added