Exemplo n.º 1
0
        public async Task CreateSnapshotAsync(
            CreateSnapshotMessage message,
            ILogger logger,
            CancellationToken cancellationToken)
        {
            try
            {
                if (message.UserId == null)
                {
                    await this.createAllSnapshots.ExecuteAsync();
                }
                else
                {
                    await this.createSnapshotMultiplexer.ExecuteAsync(message.UserId, message.SnapshotType);
                }
            }
            catch (SqlException t)
            {
                // 2627 indicates a primary key violation, which means two snapshots
                // occured at the same time. It will be automatically retried
                // so no need to log this.
                if (t.Number != 2627)
                {
                    logger.Error(t);
                }

                throw;
            }
            catch (Exception t)
            {
                logger.Error(t);
                throw;
            }
        }
Exemplo n.º 2
0
 public static Task CreateSnapshotAsync(
     [QueueTrigger(Constants.RequestSnapshotQueueName)] CreateSnapshotMessage message,
     TextWriter webJobsLogger,
     int dequeueCount,
     CancellationToken cancellationToken)
 {
     return(SnapshotProcessor.CreateSnapshotAsync(
                message,
                CreateLogger(webJobsLogger),
                cancellationToken));
 }