Song Quota Bug

Dazed
Dazed
@dazed
11 years ago
1,022 posts
This has been happening off and on for many months. I have a 5 song count quota. When a user has 5 songs and deletes a song to add a new one, they get an error that they are at their quota even though they only have 4 songs. I have a user with 3 songs (he deleted another) and still no go.

What I have ended up doing is adding a song as an admin and then having them modify it. How many other users have tried and walked away could be plentiful though so a fix would be nice.

Could it be that when a song is deleted the count is cached and not updated immediately? This error is hard to duplicate so I am kind of scratching my head.
updated by @dazed: 09/12/14 08:20:17PM
brian
@brian
11 years ago
10,148 posts
Like I mentioned in my email response, I don't believe this is caching (I have checked it). I've tested here and it all works as it should for me (I have my cache timer set to 3600).

If you can tell me specifically how to reproduce it (the best you can) I can check it out.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 08/09/14 12:41:15PM
brian
@brian
11 years ago
10,148 posts
I should add here is how I am testing it:

1) log in as a "normal" user account in a quota that has a 5 song limit.
2) create 5 songs - try to add another and get error
3) delete a song
4) I can now add a song

Try that on your system and let me know if you see an issue.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Dazed
Dazed
@dazed
11 years ago
1,022 posts
Thanks Brian. I am testing a variety of different ways and no such luck. I will get in touch with the last 2 people who messaged me and see if they had a different scenario.
Dazed
Dazed
@dazed
11 years ago
1,022 posts
contacted the member and asked him to try again. He had no issues uploading today.

Thoughts?
brian
@brian
11 years ago
10,148 posts
Dazed:
contacted the member and asked him to try again. He had no issues uploading today.

Thoughts?

I'm not sure... I don't see an issue. If you can replicate it, let me know the steps you take.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Dazed
Dazed
@dazed
11 years ago
1,022 posts
Brian I looked at this running multiple scenarios and could not duplicate it but I have had several users email me with this issue. I hate when this happens since it make debugging impossible!!

I will let you know if I ever figure the steps out.
michael
@michael
11 years ago
7,772 posts
I can see this happening. checking it out now.

To reproduce:
* set quota limit to 5
* add songs individually 1 ~ 5.
* songs are added by going to the profile page site.com/user-name/audio and clicking the + button.

When the number of songs reaches 5 and the + button is clicked again an alert window will show with
Quote: "You have created the maximum number of items of this type allowed by your Quota plan"

* click the trash icon for the last song on the list.
* after the page refreshes, click the + icon.

The only noticeable thing that is different is that when there were actually 5 songs the alert would show in a javascript popup alert. Now that there are only 4 songs the user is redirected to /audio/create where the text shows in an orange window on the page.

Looking for why now.

--update--
if the admin then clears the caches, the user is able to reach the /audio/create screen and create a new audio item.
updated by @michael: 08/11/14 07:08:01PM
Dazed
Dazed
@dazed
11 years ago
1,022 posts
Yep - You got it - followed your steps and hit "You have created the maximum number of items of this type allowed by your Quota plan" Nicely done!
updated by @dazed: 08/11/14 07:13:47PM
michael
@michael
11 years ago
7,772 posts
The cause is $_user['profile_jrAudio_item_count'] is staying at 5 even after the item is deleted.

Looking for why now.
Dazed
Dazed
@dazed
11 years ago
1,022 posts
I have to say kudos on this Michael. Very well done.
michael
@michael
11 years ago
7,772 posts
found a fix for it, just want to get brian's ok on it before getting it out there as there are a couple of ways to do it.

It will be sorted in an upcoming release.
Dazed
Dazed
@dazed
11 years ago
1,022 posts
thanks Michael!
brian
@brian
11 years ago
10,148 posts
michael:
The cause is $_user['profile_jrAudio_item_count'] is staying at 5 even after the item is deleted.

Looking for why now.

I will check out the code, but I do not believe that is true. jrCore_db_delete_item takes care of decrementing the count keys, and I'm 100% certain that works. So it's going to be something else.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
11 years ago
10,148 posts
I've confirmed that when you delete an audio file, the profile_jrAudio_item_count key is properly decremented (the jrCore_db_delete_item handles it). So that's not the problem.

The problem would have to be one of caching, but I've tested that as well and it is correct.

I will test more to see if I can replicate it, but so far I have not been able to.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 08/12/14 10:28:50AM