2020from .errors import ArchivistUnconfirmedError
2121from .utils import backoff_handler
2222
23- MAX_TIME = 1200
23+ MAX_TIME = 300
2424LOGGER = getLogger (__name__ )
2525
2626# pylint: disable=protected-access
@@ -78,6 +78,7 @@ def _wait_for_confirmation(
7878
7979@backoff .on_predicate (
8080 backoff .expo ,
81+ max_value = 30.0 ,
8182 logger = None , # pyright: ignore
8283 max_time = __lookup_max_time ,
8384 on_backoff = backoff_handler ,
@@ -94,19 +95,17 @@ def _wait_for_confirmation(self: Managers, identity: str) -> ReturnTypes:
9495 f"cannot confirm { identity } as confirmation_status is not present"
9596 )
9697
97- if entity [CONFIRMATION_STATUS ] == ConfirmationStatus .FAILED .name :
98+ status = entity [CONFIRMATION_STATUS ]
99+ if status == ConfirmationStatus .FAILED .name :
98100 raise ArchivistUnconfirmedError (
99101 f"confirmation for { identity } FAILED - this is unusable"
100102 )
101103
102- # Simple hash
103- if entity [CONFIRMATION_STATUS ] == ConfirmationStatus .CONFIRMED .name :
104- return entity
105-
106- # merkle_log
107- if (
108- ConfirmationStatus [entity [CONFIRMATION_STATUS ]].value
109- >= ConfirmationStatus .COMMITTED .value
104+ # Simple hash and merkleLog
105+ if status in (
106+ ConfirmationStatus .CONFIRMED .name ,
107+ ConfirmationStatus .COMMITTED .name ,
108+ ConfirmationStatus .UNEQUIVOCAL .name ,
110109 ):
111110 return entity
112111
@@ -124,6 +123,7 @@ def __on_giveup_confirmed(details: "Details"):
124123
125124@backoff .on_predicate (
126125 backoff .expo ,
126+ max_value = 30.0 ,
127127 logger = None , # pyright: ignore
128128 max_time = __lookup_max_time ,
129129 on_backoff = backoff_handler ,
@@ -137,12 +137,19 @@ def _wait_for_confirmed(
137137) -> bool :
138138 """Return False until all entities are confirmed"""
139139
140- # look for unconfirmed entities
140+ # look for pending entities
141141 newprops = deepcopy (props ) if props else {}
142142 newprops [CONFIRMATION_STATUS ] = ConfirmationStatus .PENDING .name
143+ LOGGER .debug ("Count pending entities %s" , newprops )
144+ pending_count = self .count (props = newprops , ** kwargs )
145+
146+ # look for stored entities
147+ newprops = deepcopy (props ) if props else {}
148+ newprops [CONFIRMATION_STATUS ] = ConfirmationStatus .STORED .name
149+ LOGGER .debug ("Count stored entities %s" , newprops )
150+ stored_count = self .count (props = newprops , ** kwargs )
143151
144- LOGGER .debug ("Count unconfirmed entities %s" , newprops )
145- count = self .count (props = newprops , ** kwargs )
152+ count = pending_count + stored_count
146153
147154 if count == 0 :
148155 # did any fail
0 commit comments