Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ internal class ContainerScanInfo
public DateTime CurrentSweepCycleLatestModified { get; set; }

public BlobContinuationToken ContinuationToken { get; set; }
public DateTime CurrentSweepCycleStartTime { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public async Task RegisterAsync(CloudBlobContainer container, ITriggerExecutor<B
{
Registrations = new List<ITriggerExecutor<BlobTriggerExecutorContext>>(),
LastSweepCycleLatestModified = latestStoredScan ?? DateTime.MinValue,
CurrentSweepCycleStartTime = DateTime.MinValue, // value not used as it is set on first use when the continuationToken is null.
CurrentSweepCycleLatestModified = DateTime.MinValue,
ContinuationToken = null
};
Expand Down Expand Up @@ -214,6 +215,7 @@ public async Task<IEnumerable<ICloudBlob>> PollNewBlobsAsync(
// if starting the cycle, reset the sweep time
if (continuationToken == null)
{
containerScanInfo.CurrentSweepCycleStartTime = DateTime.UtcNow;
containerScanInfo.CurrentSweepCycleLatestModified = DateTime.MinValue;
}

Expand Down Expand Up @@ -259,7 +261,8 @@ public async Task<IEnumerable<ICloudBlob>> PollNewBlobsAsync(
var properties = currentBlob.Properties;
DateTime lastModifiedTimestamp = properties.LastModified.Value.UtcDateTime;

if (lastModifiedTimestamp > containerScanInfo.CurrentSweepCycleLatestModified)
// if we are not the first page of this scan (ie, we have a continuation token), then we can not advance past the time the first page was called, otherwise we might miss updates to those blobs
if (lastModifiedTimestamp > containerScanInfo.CurrentSweepCycleLatestModified && (continuationToken == null || lastModifiedTimestamp < containerScanInfo.CurrentSweepCycleStartTime))
{
containerScanInfo.CurrentSweepCycleLatestModified = lastModifiedTimestamp;
}
Expand Down