-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hitting consistent "Failed" status on scheduled posts #2
Comments
Hi @pkfrank! Sorry for the slow follow-up. Busy times. Very happy to hear you've found this utility helpful. :) Sorry to see you're hitting these sporadic errors. Let me investigate and see if I can isolate what's happening in these cases. Are you aware of any changes to the DEV API? Not likely the problem since some days are still working, but good to rule out. |
Hey @toddanglin I chatted with a few members of the DEV Team and we think it might be related to rate limiting on our API. Is there any way you can tell us which errors the tool is receiving? That will help us continue looking into this from our side. |
Okay. Taking a closer look at this now that Build is done. The errors do not seem be related to rate limiting. The posts that fail to publish consistently have this error:
Unfortunately, I do not have in the logs exactly what the JSON response was before the parsing error. I will update the logging to capture that in the future. In the meantime... It's not immediately clear what is unique about the posts that are failing. One commonality is that all failed posts are created with the v1 editor (so we're trying to update the markdown instead of directly manipulating the JSON). None of the v2 editor posts seem to be failing. I will take a closer look at the posts you included in the screenshot and see if any differences between the successes and failures emerge. |
On additional consideration, it could be rate limiting...but unfortunately I was not handling cases where responses from the DevTo API did not return valid JSON...so I was not logging plain text REST error messages. I've added that logging now so I can capture in the future. Since this utility uses the user's API key to publish, the rate limiting would be more likely if you knew the API keys in question were used heavily. Do you know if the API keys you're using are subject to the rate limiting? Further, do you know what HTTP error message text is returned when rate limiting (HTTP 429) is hit? If it starts with "R", that increases that odds that's what was happening here. |
I think I answered my own question. In a quick test tonight, I hit the HTTP 429 which provides the error text: That said, what is being monitored for rate limiting? I would have assumed API key, but it's very unlikely my API key was generating more than 150 requests per 30 seconds. Is there something else that could cause a 429? In the meantime, Azure Durable Functions does provide an ability to automatically retry an operation after a delay if it fails. I will try adding that to this utility to see if it can be more resilient to intermittent 429 errors. |
Okay. Some more testing tonight and it seems the DevTo API is "locking" API keys once they become rate limited. While trying to publish a test post with an old API key, it constantly got 429 errors, even with multiple retries over several minutes. When I tried scheduling the same post with a fresh API key, it published as scheduled the first time. @pkfrank Can you share more about how the API rate limiting/locking works? I agree that's likely the culprit here, but it seems there may be a problem "releasing" an API key after it gets locked. |
We have a couple different approaches to Rate Limiting all of which can be found in our DEV codebase.
Hope that helps! |
Thanks, Molly! That definitely helps. Based on this, I think the problem could be the first limit, for a couple reasons:
This would generally explain why we mostly see these failures today with post created with the "v1" editor. And it would explain why they sometimes succeed (when the time between the two publishing attempts exceeds 1 second). Ideally, setting the |
I can do C) and add the API-key to the throttle key we use. In addition to that, I would suggest that adding retry logic to your flow to retry the request in the event of a 429 response.
The 1 request/1 second limit is only present on the API, not on our editor through the app so this shouldn't be an issue for any of the editors |
Cool. Adding the API key to the throttle key will help avoid hard to predict race conditions. There is retry logic in the flow today, but each retry runs the same flow of trying to update the JSON
Thanks again for your input. |
As far as I can tell, the editor version is not something we track at the article level. |
I think I could detect posts created by the v1 editor by inspecting the Reviewing the code flow for this tool, I realize that the reason I don't do this today is because I don't explicitly attempt to request an article's content before publishing. The first time I get an article's full detail is as part of the response for the I'll investigate today. I think I've got what I need to find a solution (one way or another). |
Hi @toddanglin, Peter from DEV here. Thank you for this amazing tool. It might surprise you, but we actually make use of PublishTo.dev for recurring posts such as our Challenge Threads.
We've been hitting issues with hitting a "Failed" status on scheduled posts. Screenshot below.
Can we possibly help out in any way to troubleshoot the issue with you?
Screenshot
The text was updated successfully, but these errors were encountered: