public async Task <List <Resource> > GetResourcesActivity(
            [ActivityTrigger] int processingDataMax)
        {
            string qDef      = $"SELECT TOP {processingDataMax} * FROM c WHERE c.type='Article' AND (c.status=null OR c.status='')";
            var    resources = await repoResource.GetAsync(sqlQuery : qDef);

            var resourceList = new List <Resource>();

            foreach (var item in resources.Items)
            {
                resourceList.Add(item);
            }

            return(resourceList);
        }
        public async Task UpdateVideoStatus([TimerTrigger("32 */3 * * * *")] TimerInfo myTimer, ILogger log)
        {
            try
            {
                var updateEncoderStatusApiConn = Environment.GetEnvironmentVariable("UpdateEncoderStatusAPIConn");
                if (string.IsNullOrEmpty(updateEncoderStatusApiConn))
                {
                    throw new ArgumentException("config 'UpdateEncoderStatusAPIConn' cannot be empty");
                }

                string query         = "SELECT TOP 100 * FROM c WHERE c.type='Video' AND (c.status='migrating-encoding' OR c.status='pending')";
                var    resourcesTemp = await repoResource.GetAsync(sqlQuery : query);

                var resourceList = new List <Resource>();
                foreach (var item in resourcesTemp.Items)
                {
                    resourceList.Add(item);
                }

                if (resourceList.Count == 0)
                {
                    return;
                }

                var tasklist  = new List <Task>();
                var increment = 0;
                foreach (var resource in resourceList)
                {
                    tasklist.Add(UpdateResourceVideoStatus(resource));
                    if (++increment % 10 == 0)
                    {
                        await Task.WhenAll(tasklist);

                        tasklist.Clear();
                    }
                }
                await Task.WhenAll(tasklist);
            }
            catch (ArgumentException ex)
            {
                log.LogWarning($"{ex.Message}\r\n{ex.InnerException?.Message}");
            }
            catch (Exception ex)
            {
                log.LogError($"{ex.Message}\r\n{ex.InnerException?.Message}");
            }
        }