Skip to content
Snippets Groups Projects
Commit f33e5f40 authored by Antoine Pietri's avatar Antoine Pietri
Browse files

cookers: readable message for SQL timeouts

parent a63a8ae9
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
import abc
import io
import logging
from psycopg2.extensions import QueryCanceledError
from swh.model import hashutil
......@@ -111,7 +112,11 @@ class BaseVaultCooker(metaclass=abc.ABCMeta):
self.fileobj = BytesIOBundleSizeLimit(size_limit=self.max_bundle_size)
try:
self.prepare_bundle()
try:
self.prepare_bundle()
except QueryCanceledError:
raise PolicyError(
"Timeout reached while assembling the requested bundle")
bundle = self.fileobj.getvalue()
# TODO: use proper content streaming instead of put_bundle()
self.backend.put_bundle(self.CACHE_TYPE_KEY, self.obj_id, bundle)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment