Forum Discussion

saintmichael's avatar
saintmichael
Icon for Nimbostratus rankNimbostratus
May 12, 2022

stuck on a spinner

I have a case of a very long running database query, and I need spinner to entertain  the users. But  I cannot figure it  out.

location /longtest {
default_type  'text/html; charset=UTF-8';
 content_by_lua_block {
                local h = io.popen('bash -c "/usr/sbin/longtest.sh"');
                if h then
                     local r = h:read("*a");
                     ngx.say(r);
                end
            }
}

I need to show a spinner until my query is ready to show the data. How would you accomplish this using nginx?