Closed BasitBulbulia closed 8 months ago
Hey @BasitBulbulia, I think there might be a logic problem in this code. It looks like you're trying to check if the Shopify domain is valid before making a call to the Shopify API? But I don't see where you're making a call to the API except only to check if the domain is valid. The domain check itself is not a real Shopify API call and shouldn't trip any leaky bucket policies.
Try changing your code to this:
Dim isValidDomain = Await ShopifySharp.AuthorizationService.IsValidShopDomainAsync(urlFromUser)
If isValidDomain Then
Dim products = Await productService.ListAsync();
Else
' MsgBox("not valid -> shopify url:" & urlFromUser)
' Call ProductDetail.NewShopifyID()
err = err + 1
Thread.Sleep(3000)
If err > 3 Then
ProductDetail.LstFiles.Items.Add("Unfortuntely your shopify usage has been throttled ! ! ")
Exit Sub
End If
GoTo trygain
End If
I think you should also move the lines where you create the product service and set the execution policy outside of the tryagain
label. I'm not positive, but I think resetting the policy on each try may cause the policy to forget its "state" and then hit the limit.
I am using leakybucket and am still being throttled ; is my code logically correct or am I doing something wrong?