mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
bitbake: hashserv: server: Support searching upstream for outhash
Use the new get-outhash message to perform a read-only query against an upstream server (if present) when a reported taskhash/outhash combination is not found in the current database. If a matching entry is found upstream it is copied into the current database so it can be found by future queries. (Bitbake rev: 2be4f7f0d2ccb09917398289e8140e1467e84bb2) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
94f34b951b
commit
73160aac06
@@ -130,6 +130,18 @@ async def copy_from_upstream(client, db, method, taskhash):
|
||||
d = {k: v for k, v in d.items() if k in TABLE_COLUMNS}
|
||||
keys = sorted(d.keys())
|
||||
|
||||
with closing(db.cursor()) as cursor:
|
||||
insert_task(cursor, d)
|
||||
db.commit()
|
||||
|
||||
return d
|
||||
|
||||
async def copy_outhash_from_upstream(client, db, method, outhash, taskhash):
|
||||
d = await client.get_outhash(method, outhash, taskhash)
|
||||
if d is not None:
|
||||
# Filter out unknown columns
|
||||
d = {k: v for k, v in d.items() if k in TABLE_COLUMNS}
|
||||
keys = sorted(d.keys())
|
||||
|
||||
with closing(db.cursor()) as cursor:
|
||||
insert_task(cursor, d)
|
||||
@@ -359,6 +371,14 @@ class ServerClient(object):
|
||||
|
||||
row = cursor.fetchone()
|
||||
|
||||
if row is None and self.upstream_client:
|
||||
# Try upstream
|
||||
row = await copy_outhash_from_upstream(self.upstream_client,
|
||||
self.db,
|
||||
data['method'],
|
||||
data['outhash'],
|
||||
data['taskhash'])
|
||||
|
||||
# If no matching outhash was found, or one *was* found but it
|
||||
# wasn't an exact match on the taskhash, a new entry for this
|
||||
# taskhash should be added
|
||||
|
||||
Reference in New Issue
Block a user