mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-06-02 14:39:30 +00:00
Removes waitForSubmitted from RequestStorage call.
This commit is contained in:
parent
789852bf1a
commit
f58a42a1ca
@ -46,12 +46,7 @@ namespace CodexClient
|
||||
|
||||
Log($"Storage requested successfully. PurchaseId: '{response}'.");
|
||||
|
||||
var contract = new StoragePurchaseContract(log, codexAccess, response, purchase, hooks);
|
||||
contract.WaitForStorageContractSubmitted();
|
||||
|
||||
hooks.OnStorageContractSubmitted(contract);
|
||||
|
||||
return contract;
|
||||
return new StoragePurchaseContract(log, codexAccess, response, purchase, hooks);
|
||||
}
|
||||
|
||||
public string MakeStorageAvailable(StorageAvailability availability)
|
||||
|
||||
@ -28,6 +28,7 @@ namespace CodexClient
|
||||
private DateTime? contractSubmittedUtc = DateTime.UtcNow;
|
||||
private DateTime? contractStartedUtc;
|
||||
private DateTime? contractFinishedUtc;
|
||||
private string lastState = string.Empty;
|
||||
|
||||
public StoragePurchaseContract(ILog log, CodexAccess codexAccess, string purchaseId, StoragePurchaseRequest purchase, ICodexNodeHooks hooks)
|
||||
{
|
||||
@ -54,8 +55,10 @@ namespace CodexClient
|
||||
|
||||
public void WaitForStorageContractSubmitted()
|
||||
{
|
||||
var raiseHook = lastState != "submitted";
|
||||
WaitForStorageContractState(gracePeriod, "submitted", sleep: 200);
|
||||
contractSubmittedUtc = DateTime.UtcNow;
|
||||
if (raiseHook) hooks.OnStorageContractSubmitted(this);
|
||||
LogSubmittedDuration();
|
||||
AssertDuration(PendingToSubmitted, gracePeriod, nameof(PendingToSubmitted));
|
||||
}
|
||||
@ -102,7 +105,6 @@ namespace CodexClient
|
||||
|
||||
private void WaitForStorageContractState(TimeSpan timeout, string desiredState, int sleep = 1000)
|
||||
{
|
||||
var lastState = "";
|
||||
var waitStart = DateTime.UtcNow;
|
||||
|
||||
Log($"Waiting for {Time.FormatDuration(timeout)} to reach state '{desiredState}'.");
|
||||
|
||||
@ -158,6 +158,9 @@ namespace AutoClient.Modes.FolderStore
|
||||
WaitForSubmitted(request);
|
||||
WaitForStarted(request);
|
||||
|
||||
stats.StorageRequestStats.SuccessfullyStarted++;
|
||||
saveChanges();
|
||||
|
||||
Log($"Successfully started new purchase: '{entry.PurchaseId}' for {Time.FormatDuration(request.Purchase.Duration)}");
|
||||
}
|
||||
catch (Exception exc)
|
||||
@ -178,7 +181,6 @@ namespace AutoClient.Modes.FolderStore
|
||||
entry.EncodedCid = request.Purchase.ContentId.Id;
|
||||
entry.PurchaseId = request.PurchaseId;
|
||||
entry.PurchaseFinishedUtc = DateTime.UtcNow + request.Purchase.Duration;
|
||||
stats.StorageRequestStats.SuccessfullyStarted++;
|
||||
saveChanges();
|
||||
Log("Saved new purchaseId: " + entry.PurchaseId);
|
||||
return request;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user