ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Fix "Loading Update" message #1206

Closed ctm closed 1 year ago

ctm commented 1 year ago

Try to reproduce an incorrect "Loading Update" message associated with a crashed container, then fix it to be accurate.

The nightly tournament died the night before last (i.e. on Friday, August 18th). There were three participants, and in email, two of the three mentioned that they were getting a status message that I believe must be the "Loading Update" message that the lobby generates after it gets a fetch response with no etag:

    fn got_fetch_response(&mut self, response: JsValue) -> bool {
        match response.dyn_into::<Response>() {
            Err(e) => {
                self.sleep_then_try_again(format!("Unlikely dyn_into error: {}", human(e)), true);
            }
            Ok(response) => match response.headers().get("etag") {
                Err(e) => {
                    self.sleep_then_try_again(format!("Unlikely etag error: {}", human(e)), true);
                }
                Ok(None) => {
                    self.sleep_then_try_again("Loading Update".to_string(), false);
                }

The problem is that although a response lacking an etag header is most likely due to mb2 being in the process of receiving a new client, it apparently can also happen after a crashed container, in which case we're telling the users something that isn't true.

This is similar to #1072 where I made mb2 say "Unable to Contact Server" instead of "Offline (Probably for Maintenance)".

I'll try to reproduce the problem locally, but more likely I'll need to test it on something running through Cloudflare, which will presumably just be craftpoker.com when nobody else is using it. Once I can reproduce it, I can figure some sort of wording that is less definitive than "Loading Update".

ctm commented 1 year ago

FWIW, I can't reproduce locally, but it's trivial to reproduce on craftpoker.com. That makes me think it's related to Cloudflare. I'll add a little instrumentation to the client and see if that can tell me anything.

ctm commented 1 year ago

Fixed. It'll now say "Server Unavailable" on a crash, rather than "Loading Update". It will, continue to say "Loading Update" when it's really loading an update.