The issue where the interface becomes stuck during periodic calls to the Poll function before recording completion is likely caused by one or more of the following reasons:
Blocking Operations in the Poll Function: If the Poll function performs time-consuming tasks (e.g., synchronous I/O, heavy computations, or waiting for external responses), it can block the main thread, causing the UI to freeze.
Poll function that queries a database or waits for a network response synchronously will halt UI updates.High Polling Frequency: If the Poll function is called too frequently (e.g., every few milliseconds), it may overwhelm the system, leading to performance degradation and UI unresponsiveness.
Lack of Asynchronous Handling: If the Poll function is not designed to run asynchronously, it can block the event loop (in single-threaded environments like JavaScript) or the main thread (in UI frameworks).
Poll function using fetch without async/await or Promises may block rendering.Resource Contention: The Poll function might be competing for shared resources (e.g., CPU, memory, or network) with other critical tasks, causing delays.
Poll function to run asynchronously (e.g., using callbacks, Promises, or coroutines) to avoid blocking the UI thread.For cloud-based solutions, Tencent Cloud's Serverless Cloud Function (SCF) can handle periodic polling tasks efficiently without affecting the main application's performance. It allows you to run code in response to events without managing servers, ensuring scalability and reliability. Additionally, Tencent Cloud's API Gateway can help manage and optimize API calls for polling operations.