Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analytics log: rewrite the logic using long polling #414

Open
rdavydov opened this issue Nov 27, 2023 · 1 comment
Open

Analytics log: rewrite the logic using long polling #414

rdavydov opened this issue Nov 27, 2023 · 1 comment
Assignees
Labels
🧱 enhancement New feature or request

Comments

@rdavydov
Copy link
Owner

Is your feature request related to a problem?

No response

Proposed solution

Analytics log: rewrite the logic using long polling

Alternatives you've considered

No response

Additional context

No response

@rdavydov rdavydov added the 🧱 enhancement New feature or request label Nov 27, 2023
@rdavydov rdavydov self-assigned this Nov 27, 2023
@rdavydov
Copy link
Owner Author

Specifically this:

    // Function to get the full log content
    function getLog() {
        if (isLogCheckboxChecked) {
            $.get(`/log?lastIndex=${lastReceivedLogIndex}`, function (data) {
                // Process and display the new log entries received
                $("#log-content").append(data);
                // Scroll to the bottom of the log content
                $("#log-content").scrollTop($("#log-content")[0].scrollHeight);

                // Update the last received log index
                lastReceivedLogIndex += data.length;

                // Call getLog() again after a certain interval (e.g., 1 second)
                setTimeout(getLog, 1000);
            });
        }
    }

and the python backend part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧱 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant