<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AzureStorage.Queue;
using Core;
using Core.Providers;
using Core.Repositories.Transactions;
using Core.Settings;
using Core.TransactionQueueWriter;
using LkeServices.Providers;
using Lykke.JobTriggers.Triggers.Attributes;
using Lykke.JobTriggers.Triggers.Bindings;
using Common;

namespace BackgroundWorker.Functions
{
    public class WaitClientSignatureMessage
    {
        public Guid TransactionId { get; set; }

        public DateTime PutDateTime { get; set; }
    }

    public class WaitClientSignaturesFunction
    {
        private readonly Func<string, IQueueExt> _queueFactory;
        private readonly ITransactionBlobStorage _transactionBlobStorage;
        private readonly TimeSpan _timeout;
        private readonly ISignatureApiProvider _clientSignatureApi;

        public WaitClientSignaturesFunction(Func<string, IQueueExt> queueFactory,
            Func<SignatureApiProviderType, ISignatureApiProvider> signatureApiProviderFactory, ITransactionBlobStorage transactionBlobStorage, BaseSettings settings)
        {
            _queueFactory = queueFactory;
            _transactionBlobStorage = transactionBlobStorage;
            _timeout = TimeSpan.FromSeconds(settings.ClientSignatureTimeoutSeconds);
            _clientSignatureApi = signatureApiProviderFactory(SignatureApiProviderType.Client);
        }

        [QueueTrigger(Constants.ClientSignMonitoringQueue)]
        public async Task ProcessMessage(WaitClientSignatureMessage message, QueueTriggeringContext context)
        {
            var signedByClient = await _transactionBlobStorage.GetTransaction(message.TransactionId, TransactionBlobType.Client);
            if (!string.IsNullOrEmpty(signedByClient))
            {
                await SendToBroadcast(message.TransactionId);
                return;
            }<commit_msg>decrease wait timeout for client sign<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AzureStorage.Queue;
using Core;
using Core.Providers;
using Core.Repositories.Transactions;
using Core.Settings;
using Core.TransactionQueueWriter;
using LkeServices.Providers;
using Lykke.JobTriggers.Triggers.Attributes;
using Lykke.JobTriggers.Triggers.Bindings;
using Common;

namespace BackgroundWorker.Functions
{
    public class WaitClientSignatureMessage
    {
        public Guid TransactionId { get; set; }

        public DateTime PutDateTime { get; set; }
    }

    public class WaitClientSignaturesFunction
    {
        private readonly Func<string, IQueueExt> _queueFactory;
        private readonly ITransactionBlobStorage _transactionBlobStorage;
        private readonly TimeSpan _timeout;
        private readonly ISignatureApiProvider _clientSignatureApi;

        public WaitClientSignaturesFunction(Func<string, IQueueExt> queueFactory,
            Func<SignatureApiProviderType, ISignatureApiProvider> signatureApiProviderFactory, ITransactionBlobStorage transactionBlobStorage, BaseSettings settings)
        {
            _queueFactory = queueFactory;
            _transactionBlobStorage = transactionBlobStorage;
            _timeout = TimeSpan.FromSeconds(settings.ClientSignatureTimeoutSeconds);
            _clientSignatureApi = signatureApiProviderFactory(SignatureApiProviderType.Client);
        }

        [QueueTrigger(Constants.ClientSignMonitoringQueue, 100, true)]
        public async Task ProcessMessage(WaitClientSignatureMessage message, QueueTriggeringContext context)
        {
            var signedByClient = await _transactionBlobStorage.GetTransaction(message.TransactionId, TransactionBlobType.Client);
            if (!string.IsNullOrEmpty(signedByClient))
            {
                await SendToBroadcast(message.TransactionId);
                return;
            }
{'fraction_non_alphanumeric': 0.05874840357598978, 'fraction_numerical': 0.0007662835249042146, 'mean_word_length': 3.7756097560975608, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2888453', 'n_tokens_mistral': 931, 'n_tokens_neox': 925, 'n_words': 207}