-
-
Notifications
You must be signed in to change notification settings - Fork 74
Listing all notifications via API takes a long time #237
Comments
I have determined that the time it takes for a request to this endpoint to return does not depend on the number of notifications. The call still took a minute to return even when I deleted notifications for all repositories. It appears to be related to the number of repositories (my Bitbucket Server instance probably has around 1000 repositories total, of which less than 100 have pull request notifications configured). |
I was able to investigate more and determine this is related to neither the number of notifications nor the number of repositories. Our notifications are configured by Chef, which periodically and regularly hits the API to do so. It appears that every time the API is used to update an existing notification, even if no values (including the UUID) change, a new copy of the notification is saved to the database. What's really interesting is that, even when the plugin is reporting that no notifications exist, there still may be notifications in the database. I cleaned out some tens of thousands of notifications from the database and now the API is responsive again. It looks like there a couple, possibly related, bugs here:
|
I had a look in the SDK setup. Where the DB is H2. Created 2 global notifications, deleted one of them, deleted the other one. Added a new one, changed it, saved it. I can see only one occurrence of the key in
What do you mean with "new object in the database"? From the plugin point of view it is just a key/value store... |
@tomasbjerre I have attached the items I found in the I also tried the same experiment you tried - I created a notification via the web UI, then deleted it via the API. It remained in the database but API calls (and the web interface) stopped showing it. Before I deleted it, I also updated the notification via the web UI and it created a new notification in the database. Here is what I am seeing now:
|
I can see that this code can be much faster. The same user is looked up, as well as all settings, for every notification that is read. Performance can definitely be increased a lot here. Will fix that. But I can't see any abandoned settings in the DB that are not exposed in the API. |
@tomasbjerre I don't see anything either that would explain why a call to Would you like me to open a new issue for the discrepancy between what notifications exist in the database and what notifications are returned by the API, and keep this issue focused on speeding up the My apologies for the poor quality bug report - I don't really have a sandbox Bitbucket to play around with, and I don't want to break the production instance or cause downtime. Let me know if there's any additional information you would like me to provide. |
We can keep it in this issue it's fine =) |
I made an optimization and released it in 3.10, for BBS 5.x. But non fix for the abandoned notifications... |
I have 98 pull request notifications set on many of my Bitbucket Server repositories (one per repository). Attempting to list all of the notifications via the API (
curl 'https://my.bitbucket.server/rest/prnfb-admin/1.0/settings/notifications' -XGET -u 'username:password'
) takes about a minute when Bitbucket is otherwise idle.Here is the profiler output which shows that the API call takes about 61 seconds:
I am using version 2.65 of the plugin and version 4.7.1 of Bitbucket.
The text was updated successfully, but these errors were encountered: