Browse Source

Position fix

pull/214/head
Sebastian Stehle 8 years ago
parent
commit
24f887f4ba
  1. 2
      src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs
  2. 2
      src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs
  3. 7
      src/Squidex.Infrastructure.GetEventStore/EventSourcing/ProjectionHelper.cs

2
src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs

@ -58,7 +58,7 @@ namespace Squidex.Infrastructure.EventSourcing
{
var streamName = await connection.CreateProjectionAsync(projectionHost, prefix, streamFilter);
var sliceStart = ProjectionHelper.ParsePosition(position) ?? -1;
var sliceStart = ProjectionHelper.ParsePosition(position);
StreamEventsSlice currentSlice;
do

2
src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs

@ -33,7 +33,7 @@ namespace Squidex.Infrastructure.EventSourcing
this.eventStoreConnection = eventStoreConnection;
this.eventSubscriber = eventSubscriber;
this.position = ProjectionHelper.ParsePosition(position);
this.position = ProjectionHelper.ParsePositionOrNull(position);
var streamName = eventStoreConnection.CreateProjectionAsync(projectionHost, prefix, streamFilter).Result;

7
src/Squidex.Infrastructure.GetEventStore/EventSourcing/ProjectionHelper.cs

@ -85,9 +85,14 @@ namespace Squidex.Infrastructure.EventSourcing
return projectionsManager;
}
public static long? ParsePosition(string position)
public static long? ParsePositionOrNull(string position)
{
return long.TryParse(position, out var parsedPosition) ? (long?)parsedPosition : null;
}
public static long ParsePosition(string position)
{
return long.TryParse(position, out var parsedPosition) ? parsedPosition : 0;
}
}
}

Loading…
Cancel
Save