IronPigeon.Relay.Controllers.InboxController.RetrieveInboxItemsAsync C# (CSharp) Method

RetrieveInboxItemsAsync() private method

private RetrieveInboxItemsAsync ( string id, bool longPoll ) : Task>
id string
longPoll bool
return Task>
        private async Task<List<IncomingList.IncomingItem>> RetrieveInboxItemsAsync(string id, bool longPoll)
        {
            var directory = this.InboxContainer.GetDirectoryReference(id);
            var blobs = new List<IncomingList.IncomingItem>();
            do
            {
                try
                {
                    var directoryListing = await directory.ListBlobsSegmentedAsync(
                        useFlatBlobListing: true,
                        pageSize: 50,
                        details: BlobListingDetails.Metadata,
                        options: new BlobRequestOptions(),
                        operationContext: null);
                    var notExpiringBefore = DateTime.UtcNow;
                    blobs.AddRange(
                        from blob in directoryListing.OfType<ICloudBlob>()
                        let expirationString = blob.Metadata[ExpirationDateMetadataKey]
                        where expirationString != null && DateTime.Parse(expirationString) > notExpiringBefore
                        select
                            new IncomingList.IncomingItem
                            {
                                Location = blob.Uri,
                                DatePostedUtc = blob.Properties.LastModified.Value.UtcDateTime
                            });
                }
                catch (StorageException)
                {
                }

                if (longPoll && blobs.Count == 0)
                {
                    await WaitIncomingMessageAsync(id).WithCancellation(this.Response.GetClientDisconnectedToken());
                }
            }
            while (longPoll && blobs.Count == 0);
            return blobs;
        }