Skip to content

Commit

Permalink
The azure timeout persister is now removing timeouts by their id
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasohlund committed May 21, 2012
1 parent a7021b1 commit 65dcee2
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ IEnumerable<TimeoutData> IPersistTimeouts.GetAll()
SagaId = c.SagaId,
State = Deserialize(c.StateAddress),
Time = c.Time,
CorrelationId = c.CorrelationId
CorrelationId = c.CorrelationId,
Id = c.RowKey
});
}


void IPersistTimeouts.Add(TimeoutData timeout)
{
var hash = Hash(timeout);
Expand All @@ -52,10 +52,8 @@ void IPersistTimeouts.Add(TimeoutData timeout)

public void Remove(string timeoutId)
{
//todo: we need to make this work using the Id of the timeout data
var hash = Hash(new TimeoutData());
TimeoutDataEntity timeoutDataEntity;
if (!TryGetTimeoutData(hash, out timeoutDataEntity)) return;
if (!TryGetTimeoutData(timeoutId, out timeoutDataEntity)) return;

RemoveSerializedState(timeoutDataEntity.StateAddress);
context.DeleteObject(timeoutDataEntity);
Expand Down Expand Up @@ -87,9 +85,8 @@ public void ClearTimeoutsFor(Guid sagaId)

public bool CanSend(TimeoutData data)
{
var hash = Hash(data);
TimeoutDataEntity timeoutDataEntity;
if (!TryGetTimeoutData(hash, out timeoutDataEntity)) return false;
if (!TryGetTimeoutData(data.Id, out timeoutDataEntity)) return false;

var leaseBlob = container.GetBlockBlobReference(timeoutDataEntity.StateAddress);

Expand Down

0 comments on commit 65dcee2

Please sign in to comment.