コード例 #1
0
        /// <summary>
        /// Update variant (price)
        /// </summary>
        static public async Task UpdateVariantAsync()
        {
            while (!AllGetQueueFilled || variantUpdateQueue.Count > 0)
            {
                if (variantUpdateQueue.Count == 0)
                {
                    await Task.Delay(500);
                }

                ProductVariant p = null;
                // SQLDone can become true whithout adding anything to Queue
                if (variantUpdateQueue.TryDequeue(out p))
                {
                    try
                    {
                        if (p.Id == null)
                        {
                            NotFoundIdVariantUpdateQueue.Enqueue(p);
                        }
                        else
                        {
                            //var result = await updateVariantService.UpdateAsync((long)p.Id, p));
                            GeneralAdapter.OutputString(p.SKU + " Prix: " + p.Price + " Compare Var (rouge): " + p.CompareAtPrice);
                        }
                    }
                    catch
                    {
                        GeneralAdapter.OutputString($"This product was sent to check its Id {p.SKU}");
                        NotFoundIdVariantUpdateQueue.Enqueue(p);
                    }
                }
            }
            variantUpdateDone = true;
            GeneralAdapter.OutputString("VariantUpdate Done.");
        }
コード例 #2
0
 /// <summary>
 /// Update variant (price)
 /// </summary>
 static public void UpdateVariantThread()
 {
     while (!AllGetQueueFilled || variantUpdateQueue.Count > 0)
     {
         ProductVariant p = null;
         // SQLDone can become true whithout adding anything to Queue
         if (variantUpdateQueue.TryDequeue(out p))
         {
             try
             {
                 if (p.Id == null)
                 {
                     NotFoundIdVariantUpdateQueue.Enqueue(p);
                 }
                 else
                 {
                     //var result = Task.Run(() => { return updateVariantService.UpdateAsync((long)p.Id, p); }).Result;
                 }
             }
             catch
             {
                 GeneralAdapter.OutputString($"This product was sent to check its Id {p.SKU}");
                 NotFoundIdVariantUpdateQueue.Enqueue(p);
             }
         }
     }
     variantUpdateDone = true;
     GeneralAdapter.OutputString("VariantUpdate Done.");
 }