On Sun, Sep 24, 2017 at 1:06 PM, Craig Russell <[email protected]> wrote: > Hi Sam, > >> On Sep 23, 2017, at 1:14 AM, Sam Ruby <[email protected]> wrote: >> >> On Fri, Sep 22, 2017 at 11:24 PM, Craig Russell <[email protected]> wrote: >>> >>> The agenda roll call has two issues: >>> >>> 1. While taking roll call, there is traffic between client and server much >>> more than is needed. The client receives multiple refreshes of the roll for >>> each participant. It is difficult to tell why the screen is refreshing. >>> It's strange that the entire roll refreshes several times. I'd like to >>> review the code and perhaps simplify it so that each participant tick box >>> generates a single message to the server and a single message back. Maybe >>> I'm dreaming. >> >> Here's the relevant code: >> >> https://github.com/apache/whimsy/blob/master/www/board/agenda/views/pages/roll-call.js.rb >> >> Notes: >> >> 1) self.pending is set to true whenever a checkbox is clicked or focus >> leaves an input field (i.e. the place where you note arrival and exit >> times) and the text in that input field has changed. >> >> 2) Whenever the screen is updated (line 206), self.pending is checked, >> and if true, a single messages is sent to the server which gets a >> single response, and self.pending is reset. Note that JavaScript is >> single threaded so this logic can't be interrupted; and that the >> response (the do..end part of the post call) is processed >> asynchronously. > > When taking roll, if things go well, it takes about three seconds per > "present" person. Less time for known attendees such as the chair and > secretary. It takes more than three seconds for the server to respond. > > My theory is that when multiple responses are pending at the server side, > they get out of order. This would be fine if each response simply refreshed > the single attendee it was created from. But if the response refreshes all of > the attendees, what we see is flashbacks in time. > > I cannot understand what is happening with the post 'minute', data do > |minutes| block. If several responses are executing this code out of order > while other Attendees are being clicked, are the results still predictable? > > I'd say that it's better for the Attendees to not talk to the server until > roll call is complete, except for looking up names for non-agenda guests. I'd > be happy if there is a (Roll Call Complete) button that sends the currently > visible roll call to the server, and initializes the Vote list for the > resolution section. We can discuss how to handle the (joined at... left at) > comments as a separate issue.
TL;DR: I may have fixed this. Here's a four line fix, that should make things better: https://github.com/apache/whimsy/commit/b0870f9b96961368cf4aaadcf6b4afb93874a9c4 Staring at the bottom, the clock counter in the header is incremented before a request is sent to the server, and is decremented once a response is received. This counter controls the display of a tiny hourglass in the left side of the header: https://github.com/apache/whimsy/blob/5d77c2ba899dc21e62114a9c9b0508c0cff0ca29/www/board/agenda/views/layout/header.js.rb#L23 What this means is that you will see an hourglass whenever there are uncompleted requests. Now for the interesting part, the first two changed lines will return the previous status while the clock_counter is greater than zero. That will prevent items becoming unchecked (or rechecked) between the times that you have made a change and the server catches up. I ran various tests on this. For one, I added a variable 0-30 second delay on each request. I opened two windows in secretary mode and checked three names in one window and then three different names in the other window. I could see the names showing up one by one in the minutes but neither one window changed during this time. Once one window completed, two of the three items checked by the other window showed up. Shortly thereafter the other window completed, and all six names were checked on both windows. I don't know how I would have done this with React.js; but it was amazingly easy with Vue.js. - Sam Ruby
