TechnionYP5777 / Bugquery

Bug query
9 stars 1 forks source link

Querying db asynchronously and refreshing when done #70

Closed Amit-Oha closed 7 years ago

Amit-Oha commented 7 years ago

I've been looking for a way to prevent the blank page while we wait for the queries to return. Spring support async methods as explained here, but I haven't find a way to reload the page when done (or even better, replace only the relevant section in the page. Maybe I'm missing something obvious because it has been a while since we worked with spring, let me know if you can think of something.

Amit-Oha commented 7 years ago

We can do this using javascript - wait for page to load (like this) and then redirect (like this)

Interesting question - how will this method affect other users who are trying to use the website while someone is querying and the server is busy waiting for the mysql call. Maybe we will have to use threads?

Amit-Oha commented 7 years ago

I tried to use this simple solution, didn't work because the page itself isn't being created until the query is done. I think there is no way around using asynchronous method for the query and somehow invoking an event to signal the page to redirect to the result. I don't have much experience with JS so I'm still researching.

AdiOmari commented 7 years ago

This is true. You have to use a service that checks if the page is ready and only then redirect to the result page.

Please look in this issue here from the accessibility project for an accelerated start with java web services (on spring): https://github.com/TechnionYP5777/SmartCity-Accessibility/issues/238

On Mon, Apr 3, 2017 at 8:23 PM, Amit Ohayon notifications@github.com wrote:

I tried to use this http://bradsknutson.com/blog/display-loading-image-while-page-loads/ simple solution, didn't work because the page itself isn't being created until the query is done. I think there is no way around using asynchronous method for the query and somehow invoking an event to signal the page to redirect to the result. I don't have much experience with JS so I'm still researching.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/TechnionYP5777/Bugquery/issues/70#issuecomment-291212487, or mute the thread https://github.com/notifications/unsubscribe-auth/AFNGFyvbZoytTRlRgWNoHCnAhFbFtCXeks5rsSsTgaJpZM4MsMYx .

Amit-Oha commented 7 years ago

I finally managed to create a page which redirects when the stacksearch is ready. @yosefraisman agreed to try to design an animation for the loading page. One problem with my current implementation is that it polls the page which makes an extra query to the db, so every time we send a new stacktrace we have two SELECT queries although one is only for checking the liveness of the address. For now I'm uploading the html page without a logo and without giving an address to it, in order to show progress.

yonzarecki commented 7 years ago

@AmitOhayon You can work on this issue, its pretty high on our website wishlist.

Amit-Oha commented 7 years ago

I did, currently I am blocked until @tonylekhtman changes the SQL query for me (b1092a4)

yonzarecki commented 7 years ago

OK, I'll re-schedule this issue to a later date.

tonylekhtman commented 7 years ago

The reason this issue is needed is because we want to display a loading screen to the user while he waits for the results. We think we can do this without querying async. Researching.