jcarbelbide / tog-crowdsourcing

Goal is to create a runelite plugin that crowdsources the optimal Tears of Guthix world.
BSD 2-Clause "Simplified" License
9 stars 0 forks source link

Refreshing worlds in plugin doesn't actually refresh / plugin data isn't being updated #21

Open warfare32 opened 2 months ago

warfare32 commented 2 months ago

Right clicking any of the borders inside the plugin and clicking on "Refresh Worlds" doesn't reload any data. I tried world hopping and it would add my data to the website but not the plugin. There appears to be some disconnect happening.

Data is being collected by the plugin to the website, but the plugin only shows a low amount of worlds / "hits". I verified that the website collected my data after world hopping a few times. I initially thought maybe the "Refresh" button isn't working which is true, but it could be a deeper issue that the entire plugin isn't able to grab the right data.

ingmarins commented 2 months ago

I opened the plugin side panel and it said worlds have reset, and hopping doesnt add to the list. I was able to sort by world/hits to populate the list in the side panel, but it is different from the list in the website. image The side panel shows none of the worlds have either gggbbb or bbbggg, but website shows they have those orders. Also, the infobox shows stream order, but as mentioned, its not added to the sidepanel list. image

jcarbelbide commented 2 months ago

Thanks for reporting. By any chance, do you both happen to be on Mac?

warfare32 commented 2 months ago

Thanks for reporting. By any chance, do you both happen to be on Mac?

I'm using Windows 10.

ingmarins commented 2 months ago

Thanks for reporting. By any chance, do you both happen to be on Mac?

the complete answer is: "no." not that i know if warfare32 is on mac, but im on windows10, so obviously "both of us" are not on mac. (computer does what you tell it to, not what you want it to)

jcarbelbide commented 2 months ago

thanks. and just so i understand, the issue youre running into is that the side panel isn't refreshed, neither automatically nor when manually clicking the refresh button? But both of you are seeing some data coming through?

IE, you are not seeing this message, correct?:

image

@ingmarins if you sort by Stream Order instead of by world number, do you see any gggbbb worlds? It's odd that you are getting a response with so many hits but not seeing any gggbbb worlds

ingmarins commented 2 months ago

that message (Worlds have reset! Please help to gather data by hopping worlds :)) was the one i saw until sorting by world/hits at which point the sidepanel got populated with some amount of worlds, none of which had the stream order gggbbb or bbbggg image even so, the website list has more worlds than what im seeing in the side panel

warfare32 commented 2 months ago

thanks. and just so i understand, the issue youre running into is that the side panel isn't refreshed, neither automatically nor when manually clicking the refresh button? But both of you are seeing some data coming through?

IE, you are not seeing this message, correct?: image

@ingmarins if you sort by Stream Order instead of by world number, do you see any gggbbb worlds? It's odd that you are getting a response with so many hits but not seeing any gggbbb worlds

thanks. and just so i understand, the issue youre running into is that the side panel isn't refreshed, neither automatically nor when manually clicking the refresh button? But both of you are seeing some data coming through?

IE, you are not seeing this message, correct?: image

@ingmarins if you sort by Stream Order instead of by world number, do you see any gggbbb worlds? It's odd that you are getting a response with so many hits but not seeing any gggbbb worlds

I think I saw that message initially. But I then clicked a column header to sort to get it to fetch current data. It loaded like 25 ish worlds but none were the GGGBBB or BBBGGG worlds so I never went to any of them. I thought oh, maybe the world's did actually reset and an optimal world hadn't been found yet. So I hopped to a world not on the list and then several others. I kept refreshing the plugin, closing or reopening it too and noticed the world's I went to did not pop up on the plugin list.

I then remembered there was a website and saw it was accurate. I verified the website collected live data but noticed the plugin still wouldn't display anything but the same 25ish worlds.

ingmarins commented 2 months ago

@warfare32 are your worlds the same as mine?

jcarbelbide commented 2 months ago

sorry you guys are running into this issue. I am a little confused on why this could be happening. If RuneLite is closed and reopened, do you still see the "please help to collect world data" message again?

On my side, I'm on mac, and actually, when i open up the client and click on the plugin icon, i don't see any data at all.

There haven't been changes to the plugin in a very long time, so it's possible a library updated and something stopped working.

I'm currently on a work trip, so i can't really dive into this too much at the moment. When I get back, I can. Sorry about this.

jcarbelbide commented 2 months ago

For now, I opened a PR to add a message to check the website while a fix is pending: https://github.com/runelite/plugin-hub/pull/6619

ingmarins commented 2 months ago

closing runelite and opening it again shows the same please collect data message, and when sorting the columns, it shows the exact same list of world as before it probably shouldnt have anything to do with worlds not resetting this week, but you never know with computer bugs. maybe it might be worth considering keeping an open JS5 connection not only with W302 but also one on each rota?

dont worry, im just glad i can help out for the future, tears of guthix arent going to run away from me, even if i have to spend some time hopping worlds for myself :)

jcarbelbide commented 2 months ago

Thanks for your help guys. Some more questions from me (and I apologize for not having these answers as I haven't been playing lately) -

  1. Was it just W302 that didnt reset this week? Or did OSRS just not have a server reset this week? I did consider that (keeping more than one js5 connection open) in the past, but the solution wasn't as stable as I wanted, and sometimes wouldn't reset the data correctly.
  2. Is data out of date right now (displaying wrong information)? We did have this issue about a month ago, but I thought it was resolved.
  3. For now, the website should be up to date, so if you use that, you shouldnt have to hop around :)

The problem with not displaying gggbbb worlds could be due to:

That's just a theory, but I don't see how else this could be broken right now. I'll take a look when i have some time. Again, thank you both @warfare32 and @ingmarins 🙏 For now, the website should be able to show the worlds, but let me know if there are problems with that too

ingmarins commented 2 months ago
  1. this week there was no game update as they are preparing for varla-more, so the only world resets were pvp rota
  2. the few stream orders i compared seem to be the same in sidepanel and website, however i did notice hits being different - that is until i refreshed the list in sidepanel, at which point the hits updated to reflect the same as the website

i think some other weeks ive seen/collected data myself to a point that the sidepanel gets a scrollbar (which it doesnt right now on 1080px high screen), so unless its changed, max number of rows shouldnt be an issue

jcarbelbide commented 2 months ago

Got it thanks. The client being out of sync with the website until a force refresh makes sense. The client only pulls data once to avoid overloading the server, unless the user requests a refresh. The website also has a 10 second delay before new results are shown on the website.

This is useful information 🙏. I'll look into it when i get back.

charlie-collard commented 2 months ago

@jcarbelbide just wanted to say thanks a lot for maintaining this plugin :)

jcarbelbide commented 2 months ago

@charlie-collard, thanks for saying that, that's always really uplifting to hear :)

Update (TLDR):

I had a bit of time to take a look at this, and I found the root cause. I pushed a change and the change is waiting to be reviewed by the RL devs. While the change is pending merge, I manually reset the world data for this week, which also fixes the issue (explained below).

Root cause:

There was this spot in the code that previously never had any issues, but was bound to at some point -

for (int i = 0; i < worldDataList.size(); i++)
{
    WorldData worldData = worldDataList.get(i);
    World world = worldResult.findWorld(worldData.getWorld_number());
    if (world == null) { return; }        // <------- This line is the problem

    if (shouldWorldBeSkipped(world, worldData, config)) { continue; }

    boolean isCurrentWorld = worldData.getWorld_number() == worldHopper.getCurrentWorld() && worldHopper.getLastWorld() != 0;

    rows.add(buildRow(
            worldData,
            i % 2 == 0,
            isCurrentWorld,
            worldLocations != null ? worldLocations.getIntValue(world.getId()) : -1)
    );
}
updateList();

The world var was never null (for like 2 years haha) until this week. worldResult is a list of available worlds that are currently online and running. I think this is updated real-time. I believe the problem was that one (or two) of the worlds that was online last week was turned off this week. If i remember correctly, this was world 319 and 580 or something. The API server stored a record of those worlds being online, so in the above loop, when trying to find that world in the available worlds, it failed to find the world. world ended up null, and the whole function returned without getting to updateList().

@ingmarins this may be why you were only seeing a partial list. I think it was populating the list up until it ran into the missing world, then when sorting by a different column, it triggers the rendering of the list, but the list was only partially filled. This is my guess.

The fix was to remove that line. There is already a null check in shouldWorldBeSkipped, so it's unnecessary. In the future, this specific rare event shouldn't cause the plugin to stop working again.

Resetting the worlds is the other solution, because there will no longer be a mismatch in the world lists. That's something I can do remotely from my side while we wait for the merge, so I did that to restore service.

It looks like y'all have already been hard at work crowdsourcing a new list of worlds, but in case it helps, i took a screenshot of the old worlds before resetting it. These worlds should still be accurate:

image

I'll close this issue once the PR is approved and merged. Thanks everyone for the help with this!

ingmarins commented 2 months ago

So does this fix it in case of worlds resetting or not resetting but just pvp rota? Would it still be worthwhile to connect JS5 to 2 or 3 worlds? One that's only on Rota A, one that's only Rota B and maybe w302? https://oldschool.runescape.wiki/w/Server#Rotation_A

jcarbelbide commented 2 months ago

I see, I understand what you're saying now. The worlds that were brought down were because of the PvP rota. Yes, you're right that if the servers don't reset one week, and the PvP rota changes, there will be some outdated information on the website, but not in the runelite plugin. There may be worlds listed on the website that aren't actually live, but the plugin will filter them out. In my mind, I think this is okay for now. Last time I played around with monitoring multiple servers, it ended up causing the service to be a bit unstable. Any incident in any of the worlds will cause a reset. W302 has been pretty reliable, so I like that we only listen to that server. Right now, ToG Crowdsourcing seems like it's behaving well (outside of this occurrence) and I'm worried about the risk of introducing those extra monitors. I do want to clarify that I don't think it's a bad idea though, and I think it's cool that you looked into how the plugin works :)

ingmarins commented 2 months ago

Between the world that's only on Rota A/B only one is typically online, although there have been cases of server infrastructure maintenance or something, resulting in them leaving all worlds on, so monitoring both of those would still take some caution