riverscuomo / spotkin_flutter

A front end for Spotkin server
https://spotkin.web.app
7 stars 4 forks source link

Only 1 of 2 playlists updates at a time #70

Closed KCreek1 closed 2 months ago

KCreek1 commented 2 months ago

It seems when there are two playlists only one will auto update at a time.

I added a second playlist on Friday evening. Set both my playlists to update at the same time each day (2am). Both Saturday(8/17) and Sunday(8/18) only my first playlist updated. The second one did not.

I did a manual update on the second one to see if I could trigger the auto update. This morning (Monday 8/19), the second playlist had updated but the first did not update.

riverscuomo commented 2 months ago

@KCreek1 it might be because Heroku's free tier will crash if a request takes longer than 30 seconds. For troubleshooting, maybe try 2 very small jobs? The really killer is sampling playlists with a lot of songs.

KCreek1 commented 2 months ago

@riverscuomo Ok. One is fairly short but I'll cut them both down to see if that will get both to update. And I'll make sure to source from some of the smaller playlists.

KCreek1 commented 2 months ago

I reduced both playlists to 5 songs each: at the scheduled time of 2am (UTC: 8) my primary updated but second did not. I further reduced both to 2 songs each and reset the update to 10am (UTC: 16) - same result. Both playlists sourced from other playlists with 50 songs each, which seems to be average for public playlists like "daily mix."

I changed the secondary only to 12 pm (UTC: 18) to see if it updates when not on the same schedule as the other.

riverscuomo commented 2 months ago

perhaps server is not set up to process multiple playlists?

KCreek1 commented 2 months ago

I was actually just asking chatgpt about this - it maybe the conflict is that I have them scheduled for the same time, so it's trying to simultaneously use the same resources (Spotify API, database) thus the second update doesn't happen.

I may get my answer if the second updates in a few minutes.

riverscuomo commented 2 months ago

If the second one doesn't finish within 30 seconds of the first one starting it will fail. That's a limitation of the free tier on the heroku server. The thing that takes time is the number of songs in the playlist your sampling. For debugging purposes you might try sampling only from the playlist that has a few songs instead of 50 songs. Also any other users playlists that are scheduled to update at that time will count against our 30 second quota, though I don't think there are any other playlists scheduled at that time.

On Tue, Aug 20, 2024, 10:54 AM Kristina Creek @.***> wrote:

I was actually just asking chatgpt about this - it maybe the conflict is that I have them scheduled for the same time, so it's trying to simultaneously use the same resources (Spotify API, database) thus the second update doesn't happen.

— Reply to this email directly, view it on GitHub https://github.com/riverscuomo/spotkin_flutter/issues/70, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZ32G4W2CPRKHFGDP6A7CDZSN7EVAVCNFSM6AAAAABMYAKIE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGQZDIMJQHA . You are receiving this because you were mentioned.Message ID: @.***>

KCreek1 commented 2 months ago

The 12 pm update didn't happen. I'm now sourcing from playlists that have between 9 and 17 songs.

KCreek1 commented 2 months ago

I adjusted both playlists - primary is 2 songs sourced from 2 playlists (13 & 17 songs) and secondary is 2 songs sourced from 2 playlists (9 & 11 songs). And I deleted any playlists that I was not sourcing from, just to clear any extra data. Still only primary updates.

riverscuomo commented 2 months ago

@KCreek1 ok, I think I set up the server to handle multiple jobs per user now. But I had to delete all our existing jobs.

KCreek1 commented 2 months ago

Ok I'll set up some new ones.

riverscuomo commented 2 months ago

@KCreek1 oh whoops, looks like it's adding another job for the same playlist every time we hit update


2024-08-21T21:16:24.547492+00:00 app[web.1]: All data:
2024-08-21T21:16:24.547497+00:00 app[web.1]: 1. rcuomo "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547508+00:00 app[web.1]: 2. rcuomo "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547517+00:00 app[web.1]: 3. rcuomo "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547519+00:00 app[web.1]: 4. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547520+00:00 app[web.1]: 5. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547528+00:00 app[web.1]: 6. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547529+00:00 app[web.1]: 7. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547530+00:00 app[web.1]: 8. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547539+00:00 app[web.1]: 9. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547539+00:00 app[web.1]: 10. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547547+00:00 app[web.1]: 11. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547547+00:00 app[web.1]: 12. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547556+00:00 app[web.1]: 13. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547556+00:00 app[web.1]: 14. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547557+00:00 app[web.1]: 15. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547565+00:00 app[web.1]: 16. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547565+00:00 app[web.1]: 17. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547573+00:00 app[web.1]: 18. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547582+00:00 app[web.1]: 19. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547583+00:00 app[web.1]: 20. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547592+00:00 app[web.1]: 21. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547592+00:00 app[web.1]: 22. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547595+00:00 app[web.1]: 23. 31ykboa4vopvikloc3jvta3rpzwy "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547606+00:00 app[web.1]: 24. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547606+00:00 app[web.1]: 25. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547607+00:00 app[web.1]: 26. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547615+00:00 app[web.1]: 27. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547615+00:00 app[web.1]: 28. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547623+00:00 app[web.1]: 29. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
2024-08-21T21:16:24.547623+00:00 app[web.1]: 30. 1277554740 "My playlist #148", Scheduled Time: 7, Index: 0, Playlist ID: 3BeoWsHRcYaEIsdncWt6kp
riverscuomo commented 2 months ago

ok I think it's fixed now.

KCreek1 commented 2 months ago

@riverscuomo it looks like both playlists updated as scheduled at UTC 15 today. I'm going to set one more update for later to confirm but it looks like it's working as expected now.

KCreek1 commented 2 months ago

@riverscuomo Sorry. I tried to go in and set the update time for both playlists back to my normal preference. When I clicked the update button for primary - worked fine, job processed.

Update button for the secondary stayed loading. I tried to leave it to see if it was just slow but it didn't exit out of loading until I closed the window. I tried a couple of times but it never got past loading.

I also tried clearing browser cache and importing the backup - which loaded fine. But that didn't resolve it.

I know it all worked as it should this morning when I manually updated both at 8:15 MDT (UTC 14:15) and they both ran the scheduled update at 9 MDT (UTC 15).

Maybe a different issue this time.

https://github.com/user-attachments/assets/b99a8645-e595-4088-9494-145ac893095f

riverscuomo commented 2 months ago

@KCreek1 no worries. Can you update chill again and I'll watch the logs?

KCreek1 commented 2 months ago

@riverscuomo ok. I'll try now.

KCreek1 commented 2 months ago

Still spinning.

riverscuomo commented 2 months ago

@KCreek1 strange. It seems the server never received the request. There must be something wrong in the webapp. Could you backup that job and send me the file? I won't actually be able to complete it because I'm not logged into your spotify but I can initiate the request and see what's happening.

KCreek1 commented 2 months ago

https://www.dropbox.com/scl/fi/xgtmw3xh45xqewfap6nkf/spotkin_jobs_backup_2024-08-22_14-25-13.json?rlkey=8gr2j8025gg22jku8dk0txixd&dl=0

riverscuomo commented 2 months ago

@KCreek1 thanks.



Error
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3  throw_
dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 600:7            _get]
packages/spotkin_flutter/screens/settings_screen.dart 8:28                   processJobs
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54           runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5           _async
packages/spotkin_flutter/services/backend_service.dart 12:72                 processJobs
packages/spotkin_flutter/screens/home_screen.dart 251:54                     _processJob
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54           runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5           _async
packages/spotkin_flutter/screens/home_screen.dart 243:42                     [_processJob]
packages/spotkin_flutter/widgets/target_playlist_widget.dart 23:23           <fn>
packages/spotkin_flutter/widgets/update_button.dart 38:7                     _handlePress
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50           <fn>
dart-sdk/lib/async/zone.dart 1661:54                                         runUnary
dart-sdk/lib/async/future_impl.dart 162:18                                   handleValue
dart-sdk/lib/async/future_impl.dart 838:44                                   handleValueCallback
dart-sdk/lib/async/future_impl.dart 867:13                                   _propagateToListeners
dart-sdk/lib/async/future_impl.dart 643:5                                    [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 713:7                                    callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7           <fn>
riverscuomo commented 2 months ago

ok should be fixed now.