Skip to content
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

overlay roster picture display and other stuff #173

Merged
merged 44 commits into from
Dec 6, 2023

Conversation

actuday6418
Copy link
Contributor

No description provided.

@TristanDebrunner
Copy link
Collaborator

@actuday6418 I finally have a working API for all the new info you need. You should be able get at it here:
{API_URL}/api/admin/get-event-team?legacyEventId={tournament_id}&legacyTeamId={team_id}
where {API_URL} is either https://api.uwhscores.prod.zmvp.host or https://api.underwater-rugby.prod.zmvp.host

@TristanDebrunner
Copy link
Collaborator

Also, I had to modify the code on master improve the inclusion of the tournament logo on the overlay. Could you ensure that the changes are merged into your PR?

@actuday6418
Copy link
Contributor Author

@actuday6418 I finally have a working API for all the new info you need. You should be able get at it here: {API_URL}/api/admin/get-event-team?legacyEventId={tournament_id}&legacyTeamId={team_id} where {API_URL} is either https://api.uwhscores.prod.zmvp.host or https://api.underwater-rugby.prod.zmvp.host

Is this a replacement for the older API? I ask cause there are changes to the json format here for data points that were not introduced as part of the new roster picture display.

I couldn't infer what the exact format of the returned data will be because I couldn't get fully populated json for the input team IDs I tried. eg:

{
  "name": "Texas",
  "logoUrl": "https://uwhscores.blob.core.windows.net/images/04ce7063-bacc-4747-980c-6839998e891c_main.jpg",
  "photos": [],
  "roster": [
    {
      "rosterName": "Charles Cook",
      "roles": [
        "Player"
      ],
      "capNumber": 20,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 22,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 15,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 25,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 7,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 14,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 6,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 19,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 87,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 17,
      "photos": []
    },
    {
      "rosterName": null,
      "roles": [
        "Player"
      ],
      "capNumber": 5,
      "photos": []
    }
  ]
}

some questions are, what will be format of the photos fields in the outer object and the inner array element objects? Are there going to be between 1 and 2 roles, with players having one role and support members having one or two depending on whether they are players as well? Overall, if you could give me an API spec instead of an endpoint, that would be helpful.

If the new API is still being worked on, you could take a look at overlay/test_server/main.py, where I've come up with a format that doesn't deviate much from the older spec. There, data points with number are treated as players, and those with a role are treated as support members.

@TristanDebrunner
Copy link
Collaborator

Unfortunately I am not writing the API, so I don't actually have a more complete detail than what I have given you. You can get a more complete example of images here:
https://api.uwhscores.prod.zmvp.host/api/admin/get-event-team?legacyEventId=37&legacyTeamId=14

I have asked the developers to modify the API to indicate which player photo is which (ie uniform, light gear, dark gear). That change should be up sometime in the next 24hrs.

In most cases players will only have the player role, but they may also have additional roles like coach in some cases. I think the best way to handle it for now is to display any roles that aren't "Player". I haven't been able to find any examples of player coaches, but you can find a team with players and coaches here:
https://api.uwhscores.prod.zmvp.host/api/admin/get-event-team?legacyEventId=37&legacyTeamId=4

Again, sorry I can't provide a complete spec, but it should be safe to assume that all calls to the API will always have a complete set of fields, just some of the values will be empty when that data is not available.

@TristanDebrunner
Copy link
Collaborator

Just got a reply back from the developers, after the change in the photos, the values of the photos fields will look like this:

{ "uniform": null, "lightGear": null, "darkGear": null }

with either a null or a URL for each photo.

For the other fields, rosterName may be null if the player has opted to hide their name, roles will always have at least one entry, and as you can already see capNumber may be null. The team's name will always be a string, but the logo may be null, and photos may be []

@actuday6418
Copy link
Contributor Author

Thanks for the update. According to what we discussed earlier:

  • Data points on the roster list with empty or null name (rosterName) fields are left out of the overlay program entirely
  • Players with invalid or empty number fields are left out of the roster list display

Should any changes be made to these?

  • The overlay has use for only one role value, as there's only a single field for it. I'll have it get this from the first entry in the roles list that isn't "Player" and ignore the rest of the entries, if any. Is this alright?
  • lightGear is supposed to be used for the white team and darkGear for black right?

@TristanDebrunner
Copy link
Collaborator

Thanks for the update. According to what we discussed earlier:

  • Data points on the roster list with empty or null name (rosterName) fields are left out of the overlay program entirely

No, their number should be shown with an empty string for the name

  • Players with invalid or empty number fields are left out of the roster list display

Correct

Should any changes be made to these?

  • The overlay has use for only one role value, as there's only a single field for it. I'll have it get this from the first entry in the roles list that isn't "Player" and ignore the rest of the entries, if any. Is this alright?

In the example video you sent, I think there were multiple roles displayed for some people, and it cycled through them. Can we keep that behavior?

  • lightGear is supposed to be used for the white team and darkGear for black right?

Correct. Unlike underwater hockey, underwater rugby uses white and blue, which is why we changed the notation

@actuday6418
Copy link
Contributor Author

actuday6418 commented Jul 15, 2023

In the example video you sent, I think there were multiple roles displayed for some people, and it cycled through them. Can we keep that behavior?

There's only a single role shown in the example video. We're only cycling through the uniformed and geared pictures for each player.

@actuday6418
Copy link
Contributor Author

The info!() at the beginning of your second screenshot got triggered twice with game number 8, but never with 9 or 10

There's something off here, since we're calling that code specifically on snapshot.next_game_number. Are you sure snapshot.next_game_number as seen by the overlay isn't 8 in that particular test case?

@TristanDebrunner
Copy link
Collaborator

As I have said a few times, the next game value in the snapshot is definitely not getting used correctly. I added the following log line and got the attached log output. You can clearly see that game 10 is not getting loaded until very near the end of the log, when the game that needs to be displayed switched from 8 to 10 (this is when is_old_game switches to false).

diff --git a/overlay/src/network.rs b/overlay/src/network.rs
index 813c4d8..5582315 100644
--- a/overlay/src/network.rs
+++ b/overlay/src/network.rs
@@ -304,6 +304,10 @@ pub async fn networking_thread(
             };
         }
         if let Ok(snapshot) = serde_json::de::from_slice::<GameSnapshot>(&buff[..read_bytes]) {
+            info!(
+                "Got snapshot from refbox with game_number: {} and next_game_number: {:?}",
+                snapshot.game_number, snapshot.next_game_number
+            );
             let tid = snapshot.tournament_id;
             let gid =
                 if snapshot.current_period == GamePeriod::BetweenGames && !snapshot.is_old_game {
Logs [2023-12-05T16:14:28.581774-05:00 INFO overlay::network] Attempting refbox connection! [2023-12-05T16:14:28.582313-05:00 INFO overlay::network] Connected to refbox! [2023-12-05T16:14:28.582329-05:00 INFO overlay::network] Networking thread initialized! [2023-12-05T16:14:28.622914-05:00 WARN overlay] Failed to read tournament logo color file: color.png : No such file or directory (os error 2) [2023-12-05T16:14:28.623056-05:00 WARN overlay] Failed to read tournament logo alpha file: alpha.png : No such file or directory (os error 2) [2023-12-05T16:14:29.345591-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:29.345718-05:00 INFO overlay::network] Fetching intial game data for tid: 0, gid: 1 [2023-12-05T16:14:29.345774-05:00 INFO overlay::network] Fetching intial game data to cache for tid: 0, gid: 1 [2023-12-05T16:14:29.354816-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-05T16:14:29.355022-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-05T16:14:29.355065-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-05T16:14:29.355106-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-05T16:14:29.355162-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-05T16:14:29.355245-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-05T16:14:30.346749-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:31.345780-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:31.345865-05:00 INFO overlay::network] Got game state update from network! [2023-12-05T16:14:32.345740-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:32.345886-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-05T16:14:33.346721-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:34.346463-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:35.349120-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:36.346146-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:37.346651-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:38.346834-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:39.349457-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:40.346263-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:41.347372-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:42.346524-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:43.348805-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:44.345986-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 1 [2023-12-05T16:14:45.345958-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:45.346139-05:00 INFO overlay::network] Got new game ID 8 / tournament ID 34 [2023-12-05T16:14:45.346150-05:00 INFO overlay::network] Fetching game data for tid: 34, gid: 8. Cache is empty or invalid! [2023-12-05T16:14:45.346180-05:00 INFO overlay::network] Fetching game data to cache for tid: 34, gid: 8 [2023-12-05T16:14:45.361607-05:00 INFO overlay::network] Got game data for tid:34, gid:8 from UWH API [2023-12-05T16:14:45.361750-05:00 INFO overlay::network] Requesting UWH API for team information for team 11 [2023-12-05T16:14:45.361785-05:00 INFO overlay::network] Requesting UWH API for team information for team 13 [2023-12-05T16:14:45.362583-05:00 INFO overlay::network] Got game data for tid:34, gid:8 from UWH API [2023-12-05T16:14:45.362686-05:00 INFO overlay::network] Requesting UWH API for team information for team 11 [2023-12-05T16:14:45.362706-05:00 INFO overlay::network] Requesting UWH API for team information for team 13 [2023-12-05T16:14:45.436652-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:46.436550-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:47.437474-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:47.437668-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-05T16:14:48.437460-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:48.437595-05:00 INFO overlay::network] Got game state update from network! [2023-12-05T16:14:49.437562-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:50.437018-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:51.437905-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:52.437905-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:53.437675-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:54.437191-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:55.436822-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:56.437825-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:57.437967-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:58.437172-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:14:59.436665-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:00.437722-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:01.437695-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:02.437769-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:03.437032-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:04.438157-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:05.439358-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:06.437480-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:07.436743-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:08.436875-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:09.437116-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:10.437075-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:11.437105-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:12.437442-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:13.437039-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:14.436889-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 0 and next_game_number: 8 [2023-12-05T16:15:15.359122-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:15.436875-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:16.361384-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:17.361594-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:18.361445-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:19.362056-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:20.361323-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:21.361608-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:22.361938-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:23.361421-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:24.361419-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:25.361668-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:26.361829-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:27.361367-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:28.362083-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:29.360905-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:30.360972-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:30.520412-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:33.541827-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:33.544141-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:34.184730-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:34.543103-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:34.712285-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:37.816741-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:37.822148-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:37.822252-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 9 [2023-12-05T16:15:38.597330-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:39.584016-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:40.585593-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:41.585208-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:42.584095-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:43.585624-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:44.584890-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:45.585553-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:46.584114-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:47.585983-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:48.591041-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:49.585252-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:50.585868-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:51.584033-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:52.585991-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:53.585157-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:54.584138-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:55.585218-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:56.585624-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:57.586118-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:58.585162-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:15:59.585795-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:00.585182-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:01.585752-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:02.585330-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:03.584225-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:04.585519-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:05.585279-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:06.584174-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:07.585232-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:08.586081-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:09.585875-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:10.585919-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:11.586336-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:12.584433-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:13.086463-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:14.492563-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:14.493934-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:14.993291-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:15.993438-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:16.992320-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:17.993307-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:18.993873-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:19.993937-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:20.992367-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:21.993429-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:22.992480-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:23.993646-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:24.993668-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:25.994281-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:26.993474-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:27.993504-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:28.993467-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:29.993418-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:30.993494-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:31.992527-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:32.993586-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:33.994101-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:34.993443-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:35.992458-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:36.993475-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:37.992479-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:38.993499-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:39.993631-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:39.993674-05:00 INFO overlay::network] Got new game ID 10 / tournament ID 34 [2023-12-05T16:16:39.993681-05:00 INFO overlay::network] Fetching game data for tid: 34, gid: 10. Cache is empty or invalid! [2023-12-05T16:16:39.993694-05:00 INFO overlay::network] Fetching game data to cache for tid: 34, gid: 10 [2023-12-05T16:16:40.002507-05:00 INFO overlay::network] Got game data for tid:34, gid:10 from UWH API [2023-12-05T16:16:40.002610-05:00 INFO overlay::network] Requesting UWH API for team information for team 14 [2023-12-05T16:16:40.002655-05:00 INFO overlay::network] Requesting UWH API for team information for team 16 [2023-12-05T16:16:40.003022-05:00 INFO overlay::network] Got game data for tid:34, gid:10 from UWH API [2023-12-05T16:16:40.003128-05:00 INFO overlay::network] Requesting UWH API for team information for team 14 [2023-12-05T16:16:40.003171-05:00 INFO overlay::network] Requesting UWH API for team information for team 16 [2023-12-05T16:16:40.993521-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:41.993782-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:41.993868-05:00 INFO overlay::network] Got game state update from network! [2023-12-05T16:16:42.992660-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:42.992710-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-05T16:16:43.992651-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:44.992557-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:45.993332-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:46.992592-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:47.994198-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:48.992619-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:49.994219-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:50.993835-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:51.994503-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:52.993619-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:53.992680-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:54.992582-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:55.993351-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:56.992677-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:57.993641-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:58.994534-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:16:59.992699-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:17:00.993633-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10 [2023-12-05T16:17:01.993750-05:00 INFO overlay::network] Got snapshot from refbox with game_number: 8 and next_game_number: 10

@TristanDebrunner
Copy link
Collaborator

Hi @actuday6418 we really need the caching problem fixed as soon as possible. We are trying to use this new overlay setup tomorrow

@actuday6418
Copy link
Contributor Author

Could you share the code from network.rs in your current checkout? Perhaps there's been some sort mess up with git that left you without some of my changes.

@TristanDebrunner
Copy link
Collaborator

TristanDebrunner commented Dec 6, 2023

network.rs.zip

git still says I'm up to date with your tmep branch, other than the info!() that I added

@TristanDebrunner
Copy link
Collaborator

TristanDebrunner commented Dec 6, 2023

I think I may be starting to understand what's wrong. In my testing the initial info that is sent to the overlay has is_old_game set to false, so gid is set to next_game on line 312 (308 without my info!()). Once the game starts, is_old_game and game_number change at the same time, so the check for whether the game number has changed finds that it hasn't changed, so nothing gets updated. I think we need an independent check of whether the next_game_number has changed, and update the cache if it has

@actuday6418
Copy link
Contributor Author

I apologize for not being of better help figuring that out. With this change, we request the cache to be filled with new game data whenever the next_game_number or tournament_id data changes. Please let me know if there are any issues with the fix.

@TristanDebrunner
Copy link
Collaborator

I think those fixes are going in the right direction, but it is making many duplicate requests to the API (see logs). My internet is a bit slow at the moment, so I'm not sure if the issue is that the requests are failing, or if it just isn't handling the returned value properly. I'm going to try to add some logging to figure out what the issue is, but if you have any ideas in the meantime let me know

Logs [2023-12-06T12:03:05.271496-05:00 WARN overlay] Failed to read tournament logo color file: No such file or directory (os error 2) [2023-12-06T12:03:05.272065-05:00 WARN overlay] Failed to read tournament logo alpha file: No such file or directory (os error 2) [2023-12-06T15:49:02.285849-05:00 INFO overlay::network] Attempting refbox connection! [2023-12-06T15:49:02.286390-05:00 INFO overlay::network] Connected to refbox! [2023-12-06T15:49:02.286417-05:00 INFO overlay::network] Networking thread initialized! [2023-12-06T15:49:02.328060-05:00 WARN overlay] Failed to read tournament logo color file: color.png : No such file or directory (os error 2) [2023-12-06T15:49:02.328231-05:00 WARN overlay] Failed to read tournament logo alpha file: alpha.png : No such file or directory (os error 2) [2023-12-06T15:49:03.092301-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T15:49:03.092463-05:00 INFO overlay::network] Fetching intial game data for tid: 0, gid: 1 [2023-12-06T15:49:03.103219-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T15:49:03.103438-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T15:49:03.103480-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:03.103496-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:03.103588-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:03.103612-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:04.092140-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T15:49:04.098393-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T15:49:04.098444-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:04.098476-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:05.090757-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T15:49:05.090822-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T15:49:05.095137-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T15:49:05.095302-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:05.095327-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T15:49:06.092885-05:00 INFO overlay::network] Got game state update from network! [2023-12-06T15:49:07.092737-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T15:49:08.092201-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T15:49:39.075334-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:39.075506-05:00 INFO overlay::network] Got new game ID 8 / tournament ID 37 [2023-12-06T15:49:39.075516-05:00 INFO overlay::network] Fetching game data for tid: 37, gid: 8. Cache is empty or invalid! [2023-12-06T15:49:39.095049-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:39.095141-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:39.095172-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:39.096399-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:39.096549-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:39.096572-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:39.946232-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:39.966029-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:39.966126-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:39.966153-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:40.944033-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:40.957059-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:40.957128-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:40.957160-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:41.944816-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:41.956519-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:41.956731-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:41.956760-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:42.944242-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:42.958772-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:42.958866-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:42.958895-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:43.943204-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:43.953170-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:43.953283-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:43.953318-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:44.943276-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:44.956101-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:44.956222-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:44.956250-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:45.942651-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:45.956748-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:45.956894-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:45.957016-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:46.942317-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:46.956546-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:46.956613-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:46.956643-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:47.941709-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:47.960982-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:47.961147-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:47.961205-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:48.940841-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:48.957915-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:48.958054-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:48.958084-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:49.941066-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:49.954277-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:49.954400-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:49.954426-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:50.940215-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:50.956490-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:50.956570-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:50.956600-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:51.939044-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:51.951335-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:51.951434-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:51.951464-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:52.939735-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:52.956591-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:52.956713-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:52.956760-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:53.939954-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:53.954827-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:53.954945-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:53.954978-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:54.939318-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:54.955337-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:54.955511-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:54.955547-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:55.938949-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:55.955154-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:55.955288-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:55.955322-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:56.937982-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:56.941857-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:56.941946-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:56.941976-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:57.938376-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:57.946798-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:57.947009-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:57.947048-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:58.940535-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:58.957253-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:58.957649-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:58.957718-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:49:59.939401-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:49:59.946844-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:49:59.946914-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:49:59.946941-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:00.938234-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:00.946055-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:00.946367-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:00.946468-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:01.937059-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:01.945943-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:01.946223-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:01.946334-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:02.937488-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:02.946137-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:02.946221-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:02.946252-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:03.937960-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:03.957115-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:03.957208-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:03.957252-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:04.936118-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:04.944137-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:04.944204-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:04.944246-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:05.937437-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:05.950673-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:05.950919-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:05.951002-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:06.982057-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:06.991339-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:06.991525-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:06.991600-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:07.939829-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:07.953917-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:07.954117-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:07.954210-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:08.936220-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:08.945509-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:08.945696-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:08.945799-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:09.699270-05:00 WARN overlay::network] Couldn't get image "https://uwhscores.blob.core.windows.net/images/88f75735-6a22-47e3-a716-a5214e33345e_main.png" from network: error sending request for url (https://uwhscores.blob.core.windows.net/images/88f75735-6a22-47e3-a716-a5214e33345e_main.png): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known [2023-12-06T15:50:09.936666-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:09.944169-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:09.944234-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:09.944267-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:10.937115-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:10.958959-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:10.959096-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:10.959177-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:11.981770-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:11.996167-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:11.996269-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:11.996303-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:12.686482-05:00 WARN overlay::network] Couldn't get image "https://uwhscores.blob.core.windows.net/images/d64102b6-65bf-4d3e-9167-bf0e2c016bdd_main.png" from network: error sending request for url (https://uwhscores.blob.core.windows.net/images/d64102b6-65bf-4d3e-9167-bf0e2c016bdd_main.png): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known [2023-12-06T15:50:12.935252-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:12.942614-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:12.942678-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:12.942711-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:13.936708-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:13.952327-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:13.952533-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:13.952654-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:14.936689-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:14.946301-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:14.946576-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:14.946648-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:15.937307-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:15.949009-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:15.949543-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:15.949637-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:16.942408-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:16.959616-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:16.959746-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:16.959787-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:17.935671-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:17.943535-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:17.943600-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:17.943636-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:18.936415-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:18.947221-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:18.947313-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:18.947352-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:19.937061-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:19.947783-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:19.948233-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:19.948374-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:20.935112-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:20.945943-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:20.946145-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:20.946212-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:21.949342-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:21.972426-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:21.972511-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:21.972548-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:22.935357-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:22.944370-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:22.944470-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:22.944516-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:23.940678-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:23.956458-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:23.956770-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:23.957920-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:24.935661-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:24.951402-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:24.951504-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:24.951542-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:25.936647-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:25.950608-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:25.950780-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:25.950857-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:26.935594-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:26.944629-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:26.944740-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:26.944782-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:27.942116-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:27.952995-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:27.953091-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:27.953133-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:28.934587-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:28.948465-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:28.948601-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:28.948649-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:29.936372-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:29.948403-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:29.948768-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:29.948886-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:30.935409-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:30.944564-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:30.944645-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:30.944676-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:31.935827-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:31.944591-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:31.944693-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:31.944733-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:32.935701-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:32.949073-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:32.949199-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:32.949246-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:33.935442-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:33.943083-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:33.943169-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:33.943201-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:34.940597-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:34.964094-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:34.964833-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:34.964996-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:35.935411-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:35.949058-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:35.949183-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:35.949210-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:36.934503-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:36.956795-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:36.956929-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:36.956978-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:37.935558-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:37.951198-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:37.951260-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:37.951286-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:38.935632-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:38.952453-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:38.952735-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:38.952783-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:39.935150-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:39.955978-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:39.956073-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:39.956101-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T15:50:40.935106-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T15:50:40.957272-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T15:50:40.957328-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T15:50:40.957354-05:00 INFO overlay::network] Requesting UWH API for team information for team 22

@TristanDebrunner
Copy link
Collaborator

Ok, I made the logging changes shown below, resulting in the attached network.rs and ran it again, logs below. It looks like the problem right now is that it requests the data again every time a new snapshot comes in, so we need to add a guard against that. I'll try to get some better internet so I can test better. If you make any changes can you please keep the logging that I added?

git diff
diff --git a/overlay/src/network.rs b/overlay/src/network.rs
index c62a20b..22cea90 100644
--- a/overlay/src/network.rs
+++ b/overlay/src/network.rs
@@ -84,6 +84,11 @@ impl TeamInfoRaw {
         )
         .unwrap();
 
+        info!(
+            "Got team information for team {}, requesting member details",
+            team_id
+        );
+
         let (members, flag) = tokio::join!(
             futures::future::join_all(
                 data["roster"]
@@ -123,6 +128,8 @@ impl TeamInfoRaw {
         );
         let members = members.into_iter().collect();
 
+        info!("Got member details for team {}", team_id);
+
         Self {
             team_name: data["name"].as_str().map_or(
                 match team_color {
@@ -174,10 +181,7 @@ async fn fetch_game_data(
             .send()
             .await
         {
-            info!(
-                "Got game data for tid:{}, gid:{} from UWH API",
-                tournament_id, game_id
-            );
+            info!("Got game data for tid:{tournament_id}, gid:{game_id} from UWH API");
             let text = data
                 .text()
                 .await
@@ -237,6 +241,7 @@ async fn fetch_game_data(
                 TeamInfoRaw::new(uwhportal_url, tournament_id, team_id_black, Color::Black,),
                 TeamInfoRaw::new(uwhportal_url, tournament_id, team_id_white, Color::White,)
             );
+            info!("Got all data for tid:{tournament_id}, gid:{game_id}. Sending to network thread");
             tr.send((
                 GameData {
                     pool,
@@ -254,7 +259,7 @@ async fn fetch_game_data(
             .unwrap();
             return;
         }
-        warn!("Game data request failed. Trying again in 5 seconds.");
+        warn!("Game data request for tid:{tournament_id}, gid:{game_id} failed. Trying again in 5 seconds.");
         tokio::time::sleep(std::time::Duration::from_secs(5)).await;
     }
 }

network.rs.zip

Logs [2023-12-06T16:03:39.403338-05:00 INFO overlay::network] Attempting refbox connection! [2023-12-06T16:03:39.403725-05:00 INFO overlay::network] Connected to refbox! [2023-12-06T16:03:39.403739-05:00 INFO overlay::network] Networking thread initialized! [2023-12-06T16:03:39.445824-05:00 WARN overlay] Failed to read tournament logo color file: color.png : No such file or directory (os error 2) [2023-12-06T16:03:39.445980-05:00 WARN overlay] Failed to read tournament logo alpha file: alpha.png : No such file or directory (os error 2) [2023-12-06T16:03:40.400659-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T16:03:40.400836-05:00 INFO overlay::network] Fetching intial game data for tid: 0, gid: 1 [2023-12-06T16:03:40.408041-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T16:03:40.408287-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T16:03:40.408326-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:40.408364-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:40.408464-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:40.408492-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:41.400131-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T16:03:41.404963-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T16:03:41.405013-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:41.405043-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:42.119103-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.119368-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.119450-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.119460-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.126683-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.126736-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.126769-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.126776-05:00 INFO overlay::network] Got all data for tid:0, gid:1. Sending to network thread [2023-12-06T16:03:42.126786-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.126804-05:00 INFO overlay::network] Got all data for tid:0, gid:1. Sending to network thread [2023-12-06T16:03:42.313401-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.313517-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.313537-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.313552-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.313565-05:00 INFO overlay::network] Got all data for tid:0, gid:1. Sending to network thread [2023-12-06T16:03:42.400200-05:00 INFO overlay::network] Fetching game data to cache for tid: 0, gid: 1 [2023-12-06T16:03:42.400417-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T16:03:42.406168-05:00 INFO overlay::network] Got game data for tid:0, gid:1 from UWH API [2023-12-06T16:03:42.406355-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:42.406380-05:00 INFO overlay::network] Requesting UWH API for team information for team 0 [2023-12-06T16:03:42.675232-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.675287-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.675316-05:00 INFO overlay::network] Got team information for team 0, requesting member details [2023-12-06T16:03:42.675349-05:00 INFO overlay::network] Got member details for team 0 [2023-12-06T16:03:42.675363-05:00 INFO overlay::network] Got all data for tid:0, gid:1. Sending to network thread [2023-12-06T16:03:43.412325-05:00 INFO overlay::network] Got game state update from network! [2023-12-06T16:03:44.399980-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T16:03:45.399339-05:00 INFO overlay::network] Got game state update from network for next_game! [2023-12-06T16:04:03.399846-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:03.400042-05:00 INFO overlay::network] Got new game ID 8 / tournament ID 37 [2023-12-06T16:04:03.400056-05:00 INFO overlay::network] Fetching game data for tid: 37, gid: 8. Cache is empty or invalid! [2023-12-06T16:04:03.420761-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:03.420899-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:03.420934-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:03.421618-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:03.421680-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:03.421699-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:03.573176-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:03.588349-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:03.588498-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:03.588532-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:03.628337-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:03.629778-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:03.630456-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:03.630632-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:03.781908-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:03.782564-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:04.572981-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:04.581938-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:04.582033-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:04.582070-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:05.000139-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:05.003696-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:05.573624-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:05.581257-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:05.581363-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:05.581424-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:06.210996-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:06.211549-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:06.571455-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:06.578529-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:06.578718-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:06.578791-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:07.014453-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:07.014785-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:07.573351-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:07.583283-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:07.583390-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:07.583426-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:08.136649-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:08.227641-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:08.573062-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:08.583573-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:08.584941-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:08.585080-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:09.050480-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:09.096837-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:09.581631-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:09.591057-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:09.591320-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:09.591402-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:10.215508-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:10.216096-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:10.572847-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:10.590570-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:10.590638-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:10.590676-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:11.102580-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:11.103136-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:11.571702-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:11.580270-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:11.580408-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:11.580482-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:12.172091-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:12.172494-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:12.573039-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:12.585972-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:12.586229-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:12.586479-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:13.173149-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:13.176246-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:13.580499-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:13.592850-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:13.593072-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:13.593157-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:14.177526-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:14.193106-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:14.572233-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:14.582556-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:14.582676-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:14.582826-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:15.343325-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:15.359942-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:15.573300-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:15.585132-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:15.585266-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:15.585334-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:16.242364-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:16.242743-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:16.572966-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:16.581341-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:16.581420-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:16.581451-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:17.276539-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:17.572380-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:17.582383-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:17.582558-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:17.582616-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:18.179869-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:18.191599-05:00 INFO overlay::network] Got team information for team 36, requesting member details [2023-12-06T16:04:18.572481-05:00 INFO overlay::network] Fetching game data to cache for tid: 37, gid: 8 [2023-12-06T16:04:18.590970-05:00 INFO overlay::network] Got game data for tid:37, gid:8 from UWH API [2023-12-06T16:04:18.591019-05:00 INFO overlay::network] Requesting UWH API for team information for team 36 [2023-12-06T16:04:18.591046-05:00 INFO overlay::network] Requesting UWH API for team information for team 22 [2023-12-06T16:04:19.230108-05:00 INFO overlay::network] Got team information for team 22, requesting member details [2023-12-06T16:04:19.230787-05:00 INFO overlay::network] Got team information for team 36, requesting member details

@TristanDebrunner
Copy link
Collaborator

I was able to make the fixes I needed with the above commit.

It now seems to work pretty fully. I think the only thing remaining is to get the jpeg decoding separated out.

I need to get this merged for our stuff tomorrow, so I'm going to merge this. Please start a new PR when you get a chance and put the jpeg decoding stuff on there

@TristanDebrunner TristanDebrunner added this pull request to the merge queue Dec 6, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Dec 6, 2023
@TristanDebrunner
Copy link
Collaborator

fixes #130
fixes #134

@TristanDebrunner TristanDebrunner added this pull request to the merge queue Dec 6, 2023
Merged via the queue into AtlantisSports:master with commit f0f88fd Dec 6, 2023
6 checks passed
@actuday6418
Copy link
Contributor Author

I think this could be a simpler solution:

diff --git a/overlay/src/network.rs b/overlay/src/network.rs
index c62a20b..b14c105 100644
--- a/overlay/src/network.rs
+++ b/overlay/src/network.rs
@@ -51,7 +51,7 @@ pub struct MemberRaw {
 }
 /// Contains information about team. `flag` here is a byte array for `Serialize`, which is
 /// processed into `Texture2D` when struct is converted into `TeamInfo`
-#[derive(Serialize, Deserialize, Clone)]
+#[derive(Serialize, Deserialize, Clone, Default)]
 pub struct TeamInfoRaw {
     pub team_name: String,
     pub members: Vec<MemberRaw>,
@@ -156,6 +156,21 @@ pub struct GameData {
     pub tournament_id: u32,
 }
 
+impl GameData {
+    pub fn default(game_id: u32, tournament_id: u32) -> Self {
+        Self {
+            pool: String::new(),
+            start_time: String::new(),
+            referees: Vec::new(),
+            black: TeamInfoRaw::default(),
+            white: TeamInfoRaw::default(),
+            sponsor_logo: None,
+            game_id,
+            tournament_id,
+        }
+    }
+}
+
 async fn fetch_game_data(
     tr: crossbeam_channel::Sender<(GameData, bool)>,
     uwhscores_url: &str,
@@ -337,6 +352,7 @@ pub async fn networking_thread(
                     )
                     .await;
                 });
+                next_game_data = Some(GameData::default(next_gid, tournament_id_new));
             }
 
             // initial case when no data is initialised

This sets the cached data to a dummy value with the correct next_game_number and tournament_id, so another request isn't triggered until the game or tournament ID changes.

I think I can also improve the loading time for the initial game data with the next PR by at most 1 second, by sending it independently instead of piggybacked on the Refbox's snapshots.

@TristanDebrunner
Copy link
Collaborator

Unfortunately the issue presents with both the cache and the main game info, but if you have a cleaner solution I will be happy to see it!

@actuday6418
Copy link
Contributor Author

actuday6418 commented Dec 7, 2023

Unfortunately the issue presents with both the cache and the main game info, but if you have a cleaner solution I will be happy to see it!

I think in that case, I'll try a simpler solution with the change to decode images this weekend. I expect to be able to run tests myself by then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants