mcndt / obsidian-toggl-integration

A Toggl integration plugin for the popular knowledge base application Obsidian.
GNU General Public License v3.0
270 stars 19 forks source link

Decrease the amount of request to the `/api/v8/time_entries/current` endpoint #17

Closed gilberthdez closed 2 years ago

gilberthdez commented 2 years ago

Greetings from Toggl TrackπŸ‘‹

Thanks for creating this integration for the Obsidian users and for adding a custom User-Agent.

We have detected that his integration is doing a lot of request GET to the /api/v8/time_entries/current endpoint. Looks like the frequency is ~1 request per second.

A good rate in terms of UX for this request(refreshing what's the current time entry) is 1 request between 5-15s.

Help us(and the users) lowering this rate. Thanks :)

mcndt commented 2 years ago

Hey! Thanks for letting me know. I will lower the rate and push a patch to the Obsidian plugin marketplace.

Is this the reason my users were getting a 418 response from the API last week? If so, I would like to humbly ask your team to consider adding a more meaningful error response than "I'm a teapot" πŸ˜… this way I would have known earlier to lower my polling rate.

gilberthdez commented 2 years ago

Is this the reason my users were getting a 418 response from the API last week? If so, I would like to humbly ask your team to consider adding a more meaningful error response than "I'm a teapot" πŸ˜… this way I would have known earlier to lower my polling rate.

That's correct and sorry for that. We weren't able to identify the source since the request were using the default got user-agent. πŸ˜…

Thanks for the quick response!

mcndt commented 2 years ago

Fixed in release 0.2.5. I'll make a post in the Obsidian discord community to ask my users to update when they can.

Obviously this makes the plugin a little less responsive (I reduced the polling interval to 6s). Are there smarter ways to get active timer updates than periodically pinging the API?

gilberthdez commented 2 years ago

Obviously this makes the plugin a little less responsive (I reduced the polling interval to 6s). Are there smarter ways to get active timer updates than periodically pinging the API?

At the moment we don't offer any other option for 3rd parties. But there's a chance that changes in the future πŸ‘

thanks for attending this request πŸ™Œ .