Intelligent dispatching method, system and medium based on feature signature
Patent Information
- Application Number
- CN202611337036.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies cannot effectively avoid redundant requests and are unable to resolve data race conditions caused by out-of-order responses, resulting in wasted network bandwidth, server load pressure, and inconsistent front-end application states.
By embedding a network request interceptor in the front-end application, a unique signature based on deep object key-value sorting is generated to achieve request multiplexing. A monotonically increasing logical clock version number is introduced for response matching and circuit breaking to ensure the timeliness and consistency of response data.
This effectively avoids redundant requests under high-frequency concurrency, reduces network resource consumption and server load, and ensures the consistency of front-end application status and user experience.
Smart Images

Figure CN123164166A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of program control, and in particular to an intelligent scheduling method, system and medium based on feature signature. Background Technology
[0002] With the development of Internet technology, the front-end and back-end separation architecture has become the mainstream model for modern Web application development. The frequency of data interaction between the front-end application and the server has increased significantly, especially in high-frequency interaction scenarios such as search suggestions and form submissions, which often trigger a large number of concurrent network requests.
[0003] Existing front-end network request processing technologies typically employ independent request sending patterns or simple URL-based caching strategies. For concurrent requests with identical parameters but initiated at different times, there's a lack of effective identification and merging mechanisms based on request content depth. This approach leads to a large number of redundant physical network requests when users perform frequent operations or when multiple page components reuse interfaces, resulting in unnecessary bandwidth waste and server load. Furthermore, when facing response timing issues caused by network latency, existing technologies cannot accurately identify the timeliness of response data. Race conditions can easily arise due to later requests returning first or earlier requests returning later, causing expired response data to incorrectly overwrite the latest application state, leading to abnormal page data display and chaotic state management.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main purpose of this application is to provide an intelligent scheduling method, system and medium based on feature signature, which aims to solve the technical problems that existing technologies cannot effectively avoid redundant requests and are difficult to solve data race state conflicts caused by out-of-order responses.
[0006] To achieve the above objectives, this application proposes an intelligent scheduling method based on feature signatures, the method comprising: A network request interceptor is embedded during the initialization phase of the front-end application to capture network requests sent by the front-end application and response messages returned by the server in both directions. Extract the element information of the network request based on preset rules and sort it by deep object key value to generate a unique feature signature; Check if there is a request with the same signature in the global request suspension pool. If it exists, block the physical sending of the current request and bridge the promise object of the current request to the resolution chain of the existing request to achieve logical multiplexing. If it does not exist, allow the physical network request and assign a monotonically increasing logical clock version number to the current request, updating the version control table; When the server response arrives, the interceptor obtains the response data and the logical clock version number it carries, matches it with the latest version number in the version control table, and executes the matching result.
[0007] In one embodiment, the step of extracting the element information of the network request based on preset rules, performing deep object key-value sorting, and generating a unique feature signature includes: Extract the request method, request path, and request payload of the network request; The nested objects in the request payload are sorted lexicographically by deep recursion to eliminate differences in attribute arrangement and obtain a normalized payload. After concatenating the request method, request path, and normalized payload into strings, a fixed-length unique signature is generated using a one-way hash digest algorithm.
[0008] In one embodiment, the step of bridging the promise object of the current request to the resolution chain of an existing request to achieve logical multiplexing includes: Based on the unique signature, the callback subscription list of existing requests is obtained from the global request suspension pool. The callback subscription list stores the resolution functions of multiple pending commitment objects associated with the existing requests. The resolution function of the commitment object of the current request is appended to the callback subscription list, causing the current request to be suspended and waiting. If the physical response to an existing request arrives and data parsing is completed, the resolution functions in the callback subscription list are called sequentially to distribute the same response data to all pending logical requests, including the current request.
[0009] In one embodiment, the steps of allowing the physical network request if it does not exist, assigning a monotonically increasing logical clock version number to the current request, and updating the version control table include: Determine the business domain identifier to which the current request belongs; Obtain the current logical clock version number corresponding to the business domain identifier mentioned in the version control table; An increment operation is performed based on the current logical clock version number to generate a new logical clock version number; The new logical clock version number is written back to update the version control table, and the unique signature is stored in the global request suspension pool.
[0010] In one embodiment, the step of obtaining response data and its carried logical clock version number based on the interceptor, matching it with the latest version number in the version control table, and executing the matching result includes: Compare the logical clock version number carried in the response data with the latest version number of the corresponding business domain in the version control table; If the two are consistent, the response is deemed valid, the response data is parsed and distributed to all pending logical requests through the bridging link; If the logical clock version number carried in the response data is later than the latest version number, the response is determined to be expired, a silent circuit breaker is executed, and the response data is discarded.
[0011] In one embodiment, the step of performing a silent circuit breaker and discarding the response data includes: The interceptor layer blocks the propagation path of response data to the upper layer application state tree; Return a commitment object that will never be resolved to the front-end application layer, thus blocking the injection of the response data into the application state tree and view layer.
[0012] In one embodiment, the method further includes a Loading state takeover and synchronization step: The interceptor layer centrally manages the loading status control of each business domain; If the logical clock version number carried in the response data is consistent with the latest version number of the corresponding business domain in the version control table, then a loading status shutdown signal is sent. When a silent circuit breaker is applied to an expired response, the loading state of the corresponding business domain remains unchanged.
[0013] In one embodiment, the method further includes an anomaly protection step: If an exception occurs in a permitted physical network request, obtain the exception version number of the request that triggered the exception. If the abnormal version number is equal to the latest version number of the corresponding business domain in the version control report, then the loading status of the business domain corresponding to the abnormal request is forcibly reset to closed, and the feature signature directory corresponding to the abnormal request in the global request suspension pool is cleaned up. The version number of the business domain corresponding to the abnormal request is kept from rolling back, ensuring that the version number of the retry request continues to monotonically increase.
[0014] In one embodiment, the method further includes a memory reclamation step: After the physical request is distributed or a silent circuit breaker is executed, the signature directory corresponding to the current request is queried from the global request suspension pool. Release the callback subscription list references and request context closures held in the signature directory; Remove the signature directory from the global request suspend pool to release the related memory resources.
[0015] Furthermore, to achieve the above objectives, this application also proposes a signature-based intelligent scheduling system, which includes: The interception and capture module is used to embed a network request interceptor during the initialization phase of the front-end application, and to capture network requests sent by the front-end application and response messages returned by the server in both directions. The feature signature module is used to extract the element information of the network request based on preset rules and sort the deep object key values to generate a unique feature signature. The request reuse module is used to query whether there is a request with the same signature in the global request suspension pool. If it exists, it blocks the physical sending of the current request and bridges the promise object of the current request to the resolution chain of the existing request to achieve logical multiplexing. The version control module is used by the module to allow physical network requests if they do not exist, and to assign a monotonically increasing logical clock version number to the current request and update it to the version control table. The matching processing module is used to obtain the response data and the logical clock version number carried by the interceptor when the server response arrives, and match it with the latest version number in the version control table, and execute the matching result.
[0016] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the signature-based intelligent scheduling method described above.
[0017] This application proposes an intelligent scheduling method, system, and medium based on feature signatures. The method includes: embedding a network request interceptor during the initialization phase of the front-end application to bidirectionally capture network requests sent by the front-end application and response messages returned by the server; extracting the element information of the network request based on preset rules and performing deep object key-value sorting to generate a unique feature signature; querying the global request suspend pool to see if there is a request with the same feature signature; if so, blocking the physical transmission of the current request and bridging the commitment object of the current request to the resolution link of an existing request to achieve logical multiplexing; if not, allowing the physical network request and assigning a monotonically increasing logical clock version number to the current request, updating it to the version control table; when the server response arrives, obtaining the response data and the logical clock version number carried by the interceptor, matching it with the latest version number in the version control table, and executing the matching result. This application achieves request multiplexing by using deep object key-value sorting to generate feature signatures, and introduces a monotonically increasing logical clock version number for response matching and circuit breaking. This solves the race condition problem caused by redundant requests and out-of-order responses under high-frequency concurrency in the prior art, and improves network resource optimization and data state consistency. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating an embodiment of the intelligent scheduling method based on feature signatures provided in this application. Figure 2 This is a flowchart illustrating Embodiment 2 of the intelligent scheduling method based on feature signatures in this application. Figure 3 This is a flowchart illustrating Embodiment 3 of the intelligent scheduling method based on feature signatures in this application. Figure 4 This is a flowchart illustrating Embodiment 4 of the intelligent scheduling method based on feature signatures in this application. Figure 5 This is a flowchart illustrating Embodiment 5 of the intelligent scheduling method based on feature signatures in this application; Figure 6 This is a schematic diagram of the module structure of an intelligent scheduling system based on feature signatures, as described in an embodiment of this application.
[0021] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0022] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0023] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0024] Because existing technologies cannot effectively avoid redundant requests and are difficult to resolve data race conditions caused by out-of-order responses.
[0025] This application provides a solution that achieves request multiplexing by generating feature signatures using deep object key-value sorting and introduces a monotonically increasing logical clock version number for response matching and circuit breaking. This solves the race condition problem caused by redundant requests and out-of-order responses under high-frequency concurrency in the prior art, and improves network resource optimization and data state consistency.
[0026] Based on this, embodiments of this application provide an intelligent scheduling method based on feature signatures, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the intelligent scheduling method based on feature signatures in this application.
[0027] In this embodiment, the intelligent scheduling method based on feature signatures includes steps S10 to S50: Step S10: During the initialization phase of the front-end application, a network request interceptor is embedded to capture network requests sent by the front-end application and response messages returned by the server in both directions.
[0028] It should be noted that, in this embodiment, the front-end application is a software program that runs on the user terminal (such as a browser or mobile app) and is responsible for interface display and user interaction; the initialization phase is the time window during which the front-end application starts up and performs global configuration, module loading, and environment preparation; the network request interceptor is a proxy mechanism injected into the network communication link to intercept and process requests before they are sent or responses reach the business layer; a network request is a data interaction instruction initiated by the front-end application to the server; a response message is a data packet returned by the server based on the request; bidirectional capture refers to monitoring and intercepting the data flow in both the outflow of requests and the inflow of responses.
[0029] This embodiment is used to establish a unified control gate in the underlying communication link of the front-end application. By embedding an interceptor during the initialization phase, it ensures that all network interaction behaviors are audited and scheduled by the interceptor, thereby achieving full control over the network communication process.
[0030] In one possible implementation, the insertion of a network request interceptor can be achieved by overriding the browser's native XMLHttpRequest (Extensible Hypertext Transfer Request) object or fetch method, or by introducing the interceptor interface provided by a mature HTTP client library (such as Axios).
[0031] Step S20: Extract the element information of the network request based on preset rules and sort the deep object key values to generate a unique feature signature.
[0032] It should be noted that in this embodiment, the preset rule is a predefined algorithm logic used to identify and extract key information of the request; the element information refers to the key data set that can uniquely represent the intent of a network request; the deep object key-value sorting is a normalization process of recursively sorting data objects with complex nested structures according to their key names; and the unique feature signature refers to a unique identifier string generated by calculating the normalized data.
[0033] This embodiment extracts elements such as request method, path, and payload, and performs deep sorting on nested objects that may exist in the payload. This eliminates misjudgment of request content caused by different order of object attributes, thereby generating accurate feature signatures. This ensures that even if two requests are initiated by different calls at the code level, as long as their business intent and parameter content are the same, they can be identified as the same request, providing an accurate basis for subsequent request merging.
[0034] In one possible implementation, the unique signature can be generated by converting the sorted string into a fixed-length hash value using one-way hash digest algorithms such as MD5 and SHA-1.
[0035] In one specific implementation, if one request payload is {id: 1, name: "test"} and another request payload is {name: "test", id: 1}, the system performs deep object key-value sorting on both and obtains the normalized result {"id":1,"name":"test"}, thereby generating the same feature signature and identifying that the two are essentially the same request.
[0036] Step S30: Query whether there is a request with the same signature in the global request suspension pool. If it exists, block the physical sending of the current request and bridge the promise object of the current request to the resolution link of the existing request to achieve logical multiplexing.
[0037] It should be noted that, in this embodiment, the global request suspending pool refers to the global storage space used to store information about requests that are currently in progress but have not yet received a response; blocking the physical sending of the current request means preventing the intercepted request from creating a real network connection; the promise object refers to the object used in JavaScript asynchronous programming to represent the eventual completion or failure of an asynchronous operation; bridging refers to establishing a logical connection relationship; the resolution chain refers to the callback queue used to process the results of asynchronous operations; and logical multiplexing is a mechanism that combines multiple logical requests into a single physical request.
[0038] In this embodiment, when the same signature is found in the suspend pool, no new network packet is sent. Instead, the return result of the current request is bound to the existing request, so that multiple callers can share the same network response. This effectively solves the problem of request storm caused by repeated user operations or repeated component rendering in a short period of time, and significantly reduces server pressure and network bandwidth consumption.
[0039] Step S40: If the physical network request does not exist, allow the request and assign a monotonically increasing logical clock version number to the current request, updating the version control table.
[0040] It should be noted that, in this embodiment, allowing physical network requests means allowing intercepted requests to establish real network connections and send data packets; the logical clock version number is a logical timestamp used to mark the order in which requests occur; and the version control table is a data structure used to record the latest request version number of each service domain.
[0041] In this embodiment, when a request is first initiated, a globally or locally unique incrementing version number is assigned to it and recorded in the version control table. The timing of asynchronous network requests is quantified through a logical clock mechanism, enabling the system to accurately determine the timeliness of response data, thereby solving the race condition problem caused by network latency.
[0042] In one possible implementation, the version number can be a simple auto-incrementing integer counter, or it can be a composite key value generated by combining business domain identifiers (such as user ID, list ID).
[0043] Step S50: When the server response arrives, the response data and the logical clock version number carried by the interceptor are obtained and matched with the latest version number in the version control table, and the matching result is executed.
[0044] It should be noted that in this embodiment, response data refers to the processing result returned by the server. This embodiment effectively intercepts old response data that is delayed due to network congestion through a version number matching mechanism, preventing data backflow errors where old data overwrites new data, and ensuring the consistency between the front-end application state and the view.
[0045] This application achieves bidirectional capture of network requests by embedding a network request interceptor in the front-end application, realizes logical multiplexing of duplicate requests based on unique feature signatures generated by deep object key-value sorting, and introduces a monotonically increasing logical clock version number mechanism to perform timeliness matching verification and intelligent processing of response data. It effectively avoids redundant network requests in high-frequency concurrency scenarios, significantly reduces server load and network bandwidth consumption, and accurately intercepts expired responses through the version number matching mechanism, eliminating race conditions and data inconsistencies caused by network latency, and ensuring the correctness of the front-end application state and user experience.
[0046] Furthermore, referring to Figure 2 The second embodiment of the intelligent scheduling method based on feature signatures in this application provides a flowchart, based on the above. Figure 2 The embodiment shown further refines the step S20, "extracting the element information of the network request based on preset rules and sorting the deep object key values to generate a unique feature signature," including steps A201 to A203: Step A201: Extract the request method, request path, and request payload of the network request; Step A202: Perform deep recursive lexicographical sorting on the nested objects in the request payload to eliminate attribute arrangement differences and obtain a normalized payload; Step A203: After concatenating the request method, request path and normalized payload into strings, a fixed-length unique signature is generated using a one-way hash digest algorithm.
[0047] It should be noted that, in this embodiment, the generation of a unique signature is the core basis for identifying duplicate requests and realizing logical multiplexing. It is used to eliminate non-essential differences caused by different front-end code call order and object attribute definition order, and to ensure that requests with completely identical business intent can be accurately identified as the same logical entity.
[0048] Optionally, the request method refers to the operation type defined in the HTTP protocol, such as GET, POST, PUT, etc.; the request path refers to the target URL address of the network request, used to locate the specific backend interface resource; the request payload refers to the business parameter data carried in the request, usually located in the request body or in the query parameters appended to the URL; deep recursive lexicographical sorting is a normalization process that recursively rearranges the attribute names of each level of the object, such as the request payload, which may contain multiple nested structures, in alphabetical order; and the unique signature refers to a fixed-length string that can uniquely identify the characteristics of the request content.
[0049] This embodiment first extracts three core elements from the intercepted network request: request method, request path, and request payload. Considering the uncertainty of the property order of front-end JavaScript objects, direct serialization may result in objects with the same content generating different signatures. Therefore, the system performs in-depth processing on the request payload, traversing all levels of object properties and sorting them lexicographically to generate a standardized, uniformly ordered payload, thus eliminating interference caused by differences in property arrangement. Subsequently, the system concatenates the request method, request path, and uniform payload into a complete string to be signed, and calculates a fixed-length unique signature using a one-way hash digest algorithm.
[0050] In one possible implementation, the one-way hash digest algorithm can employ either MD5 or SHA-256. The generated signature can be directly stored and retrieved as a key in the global request suspend pool. For example, assuming the system extracts a network request method of "POST", a request path of " / api / query", and an original request payload of {age: 25, name:"user"}, the normalized payload string obtained after deep recursive lexicographical sorting is {"age":25,"name":"user"}. These three elements are concatenated into the string "POST / api / query{"age":25,"name":"user"} according to a preset rule. Then, the MD5 algorithm is used to calculate this concatenated string, ultimately generating a fixed-length hash value such as "e10adc3949ba59abbe56e057f20f883e" as the unique signature of the request.
[0051] Furthermore, referring to Figure 3 The third embodiment of the intelligent scheduling method based on feature signatures in this application provides a flowchart, based on the above... Figure 3 The embodiment shown further refines the step S30, "bridging the promise object of the current request to the resolution chain of an existing request to achieve logical multiplexing," including steps A301 to A303: Step A301: Based on the unique signature, obtain the callback subscription list of existing requests from the global request suspension pool. The callback subscription list stores the resolution functions of multiple pending commitment objects associated with the existing requests.
[0052] It should be noted that an existing request is a physical network request that has been initiated previously but for which no response has yet been received; the callback subscription list refers to a data container used to record information about all subscribers waiting for the result of the request in sequence; a Promise object to be resolved is a Promise object in a Pending state; and the resolution function refers to the resolve or reject callback function used to change the state of the Promise (from Pending to Resolved or Rejected).
[0053] In this embodiment, after determining that the current request is a duplicate request, it needs to be included in management. At this time, the system uses the unique signature as the index key to query and extract the corresponding callback subscription list of existing requests from the global request suspension pool. This list actually stores all Promise resolution functions initiated before the current request that are waiting for the same response. This step is used to quickly locate the existing request context and avoid the overhead of re-initiating network connections.
[0054] Step A302: Add the resolution function of the commitment object of the current request to the callback subscription list, so that the current request is put into a suspended waiting state.
[0055] It should be noted that the resolution function of the current request's promise object refers to the resolve method of the Promise corresponding to the currently intercepted network request; append refers to the operation of adding new elements to the end of the data list; the suspended waiting state refers to the state in which the request logic is suspended and waiting for an external event to be triggered (i.e., the response to arrive).
[0056] In this embodiment, after obtaining the callback subscription list, the actual physical network transmission action is not performed. Instead, the resolution function of the current request Promise object is extracted and pushed to the end of the callback subscription list, thereby establishing a dependency relationship between the current request and existing requests. This process achieves the goal of "riding" multiple logical requests on the same physical request, effectively blocking the physical transmission of redundant requests, realizing the core mechanism of logical multiplexing, and significantly reducing network load.
[0057] In one specific implementation, when the user clicks the "Search" button a second time to trigger the same request, the system blocks the sending of the XMLHttpRequest for that request. Instead, it adds the resolve function resolve2 of the request Promise to the existing callback subscription list [resolve1] of the first request using the Array.push method, making it [resolve1, resolve2]. At this time, the second request enters a suspended waiting state.
[0058] Step A303: If the physical response to the existing request arrives and data parsing is completed, the resolution functions in the callback subscription list are called sequentially to distribute the same response data to all pending logical requests, including the current request.
[0059] It should be noted that a physical response refers to the actual data packet returned by the server in response to a sent physical network request; sequential invocation refers to traversing and executing functions in the list in the order they were added; and a logical request refers to a virtual request that has been intercepted and suspended and for which no network packet has actually been sent.
[0060] This embodiment achieves the "broadcasting" effect of request results, ensuring that all suspended logical requests can receive response data that is completely consistent with the physical requests, completing the closed loop of multiplexing, and enabling multiple callers in the front-end application layer to share the results of the same network connection without being aware of it, thereby improving the system's response speed and resource utilization.
[0061] Furthermore, referring to Figure 4 The fourth embodiment of the intelligent scheduling method based on feature signatures in this application provides a flowchart, based on the above... Figure 4 The embodiment shown further refines the step S40, "if it does not exist, allow the physical network request, assign a monotonically increasing logical clock version number to the current request, and update the version control table," including steps A401 to A404: Step A401: Determine the business domain identifier to which the current request belongs; Step A402: Obtain the current logical clock version number corresponding to the business domain identifier in the version control table; Step A403: Perform an increment operation based on the current logical clock version number to generate a new logical clock version number; Step A404: Write the new logical clock version number back to update the version control table, and store the unique signature in the global request suspend pool.
[0062] It should be noted that in this embodiment, the business domain identifier is a unique code or name used to distinguish different business logic modules or data resource ranges, such as "user list" or "order details"; the version control table refers to the data structure maintained by the system to record the latest request status of each business domain; the current logical clock version number is the latest timestamp or sequence number of a specific business domain at the current moment. After confirming that there are no requests with the same signature in the global request suspend pool, the system determines that the request is being initiated for the first time. At this time, the physical network request needs to be allowed and a version control mechanism needs to be established.
[0063] This application embodiment determines the business domain identifier of the current request, obtains and increments the logical clock version number to update the version control table, and stores the unique signature in the global request suspension pool, thus realizing the physical release and version status marking of the first request. This scheme uses a monotonically increasing logical clock mechanism to establish a strict timing benchmark for requests, providing a benchmark for judging the timeliness of response data and circuit breaking of expired responses, effectively avoiding race conditions and data inconsistencies caused by network latency.
[0064] In one possible implementation, the logical clock version number can be implemented using an incrementing integer or using a combination of timestamp and counter.
[0065] In one specific implementation, the front-end application initiates a query request for a "product list". The system parses the request path and determines the business domain identifier as "ProductList". The system queries the version control table and finds that the current logical clock version number of the "ProductList" field is 100. The system performs an increment operation to generate a new version number 101 and updates the record of "ProductList" in the version control table to 101. At the same time, the unique signature "hash_prod_2023" generated by the system based on the request payload is stored in the global request pending pool, marking that the request has officially entered the sending and waiting phase.
[0066] Furthermore, the step of obtaining response data and its carried logical clock version number based on the interceptor, matching it with the latest version number in the version control table, and executing the matching result includes A501-503: Step A501: Compare the logical clock version number carried in the response data with the latest version number of the corresponding business domain in the version control table; Step A502: If the two are consistent, the response is deemed valid. The response data is parsed and distributed to all pending logical requests through the bridging link. Step A503: If the logical clock version number carried by the response data is later than the latest version number, the response is determined to be expired, a silent circuit breaker is executed, and the response data is discarded.
[0067] It should be noted that response data refers to the actual business data content returned by the server in response to the network request sent by the front-end application; the latest version number refers to the version identifier recorded in the version control table of a specific business domain, representing the latest request initiated; the bridging link refers to the callback subscription list that connects physical requests with multiple logical requests; and silent circuit breaking refers to the handling method of directly discarding response data at the interceptor level without triggering exception prompts in the business layer.
[0068] This embodiment aims to solve the problem of out-of-order responses caused by network latency. If the two are consistent, it indicates that the response is the latest valid response. The system parses the response data and distributes it to all pending logical requests through the bridging link to complete the business process. If the version number carried by the response is later than the latest version number, it indicates that the request corresponding to the response has been replaced by a subsequent new request and is outdated data. The system executes a silent circuit breaker and directly discards the response to prevent outdated data from incorrectly overwriting the front-end application state.
[0069] In one possible implementation, the version number comparison logic can employ a strict inequality judgment, that is, it is only considered valid if the response version number is greater than or equal to the latest version number, or it is only allowed to pass if the response version number is equal to the latest version number.
[0070] Furthermore, the step of performing silent circuit breaking and discarding the response data includes A601-602: Step A601: Block the propagation path of response data to the upper layer application state tree at the interceptor layer; Step A602: Return a commitment object that will never be resolved to the front-end application layer, blocking the injection of the response data into the application state tree and view layer.
[0071] It should be noted that the interceptor layer is a communication proxy layer embedded between network requests and business logic; the propagation path refers to the channel through which data flows from the underlying network to the higher-level application; the upper-layer application state tree refers to the storage structure of the front-end application suitable for centralized data management; the front-end application layer is the business logic code layer that directly faces the user; the never-resolved promise object refers to a special Promise object whose state always remains Pending and will never become Resolved or Rejected; the application state tree and view layer refer to the data storage and interface rendering parts, respectively.
[0072] In this embodiment, after determining that the response data has expired, a silent circuit breaker mechanism is executed. The purpose is to directly cut off the propagation of expired data at the underlying level, prevent old data from contaminating the latest application state, and avoid interfering with the normal display of the user interface due to thrown errors.
[0073] Optionally, the system first blocks the propagation path of response data to the upper-layer application state tree at the interceptor layer, preventing the data packet from triggering any business logic callbacks. Additionally, the system returns a perpetually unresolved commitment object to the front-end application layer. This object puts the call chain in a "perpetual wait" state, effectively blocking the injection of response data into the application state tree and view layer. This achieves seamless handling of expired data, ensuring data consistency and improving the user experience.
[0074] In one possible implementation, the never-resolved promise object can be constructed by executing the new Promise(()=>{}) logic, that is, creating a Promise instance that does not contain resolve or reject call logic.
[0075] In one specific implementation, suppose the front-end application first sends request A with version number 10, and then sends request B with version number 11. If the response to request A arrives later than request B due to network congestion, the interceptor determines that the response version number 10 of request A is behind the current latest version number 11. It then intercepts the response at the interceptor layer, prevents it from calling the callback function of the business layer, and returns a Promise object that is always in a Pending state to the initiator of request A. This ensures that the UI components related to request A will not be incorrectly updated due to receiving old data, and that the user always sees the latest data content corresponding to version number 11.
[0076] Furthermore, referring to Figure 5 The fifth embodiment of the intelligent scheduling method based on feature signatures in this application provides a flowchart, based on the above... Figure 5 The illustrated embodiment further refines the steps of "Loading state takeover and synchronization", including steps A701 to A703: Step A701: Take over the loading status control of each business domain at the interceptor layer. Step A702: If the logical clock version number carried in the response data is consistent with the latest version number of the corresponding business domain in the version control table, then a loading status shutdown signal is sent. Step A703: When a silent circuit breaker is executed on an expired response, the loading state of the corresponding business domain remains unchanged.
[0077] It should be noted that in this embodiment, the business domain refers to different functional areas or data sets divided in the front-end application; the loading state refers to the interactive feedback state displayed by the user interface while waiting for data to load, such as a spinning animation or a skeleton screen; and the silent circuit breaker refers to the processing operation of silently discarding expired responses.
[0078] This embodiment decouples network requests from user interface interaction by centrally managing the loading status of each business domain at the interceptor layer, thus consolidating the state management logic that was originally scattered across various business components. When response data arrives, the interceptor compares the logical clock version number carried in the response with the latest version number of the corresponding business domain in the version control table. If they match, it indicates that the response is the latest valid data, and the system automatically sends a loading status shutdown signal to notify the front-end application to update the view and stop loading prompts, ensuring that users can see the data in a timely manner.
[0079] Additionally, it should be noted that when the interceptor detects that the logical clock version number carried in the response data is behind the latest version number, determines it as an expired response, and executes a silent circuit breaker, the system will maintain the loading state of the corresponding business domain unchanged. That is, it will not trigger a signal to close the loading state, nor will it reset the loading state. This avoids the problem of premature end of the loading state or interface state disorder caused by discarding expired responses, and ensures that only the response of the latest version request can truly control the end of the loading state.
[0080] This application centrally manages the loading status control of each business domain through an interceptor layer. Based on the matching result of the logical clock version number of the response data and the latest version number, it selectively executes operations such as issuing a loading status shutdown signal or maintaining the loading status unchanged. This decouples the loading status from the business logic, ensuring that the loading status only changes with the latest valid response. It effectively avoids interface status confusion or accidental shutdown caused by expired responses, thus improving the stability of the user interaction experience.
[0081] In one possible implementation, loading state management is achieved by maintaining a global boolean state object, and interceptors drive view layer updates by modifying the attribute values of the corresponding business domains in this object.
[0082] In one specific implementation, a user submits two consecutive query requests on the "Order List" page, and the system assigns them version numbers 10 and 11. An interceptor takes over the Loading state of the "Order List" business domain. Due to network issues, the response for version number 10 arrives later than that for version number 11. When the response for version number 11 arrives, the version numbers match successfully, the system sends a signal to close the Loading state, the page displays the latest data, and the loading animation is hidden. Subsequently, when the response for version number 10 arrives, the interceptor determines that its version number is behind the current latest version number 11, performs a silent circuit breaker to discard the data, and simultaneously maintains the Loading state of the "Order List" business domain.
[0083] Furthermore, the method also includes an anomaly protection step, specifically A801~A803: Step A801: If an exception occurs in the allowed physical network request, obtain the exception version number of the request that triggered the exception. Step A802: If the abnormal version number is equal to the latest version number of the corresponding business domain in the version control report, then the loading status of the business domain corresponding to the abnormal request is forcibly reset to closed, and the feature signature directory corresponding to the abnormal request in the global request suspension pool is cleaned up. Step A803: Keep the version number of the business domain corresponding to the abnormal request from rolling back, and ensure that the version number of the retry request continues to monotonically increase.
[0084] It should be noted that, in this embodiment, the physical network request refers to the network request that is actually sent and transmits data; the abnormal version number refers to the logical clock version number assigned when the request that triggers the abnormality is initiated; and the signature directory is an entry in the suspend pool used to store information related to a specific request.
[0085] When this embodiment detects an anomaly in a physical network request, it immediately obtains the anomaly version number of the request and compares it with the latest version number in the version control table. If the anomaly version number matches the latest version number, it indicates that the currently anomaly request is the latest request for that business domain. The system will then forcibly reset the loading state of that business domain to "closed" to release the user interface's wait lock, and simultaneously clean up the corresponding signature directory in the global request suspend pool to prevent memory leaks or incorrect state occupation.
[0086] Additionally, it should be noted that when handling exceptions, the system maintains the version number of the business domain corresponding to the exception request without rolling back. This is to ensure that retry requests can continue to monotonically increment based on the current version number, avoiding new requests being misjudged as expired requests due to version number rollback, thereby ensuring the continuity and effectiveness of version control.
[0087] This application addresses the issues of interface state deadlock and resource leakage when requests are abnormal, prevents retry requests from failing due to version rollback, and ensures system stability and business process continuity in abnormal scenarios.
[0088] In one possible implementation, a forced reset of the loading state is achieved by triggering a mutation or action in the global state manager, while cleaning up the signature directory can be accomplished by deleting the corresponding key-value pairs from the Map object.
[0089] In one specific implementation, the front-end application initiates a request for the "User Information" business domain, assigned version number 10. If this request fails due to a network disconnection, the system obtains the abnormal version number 10 and confirms that the latest version number of the "User Information" domain in the version control table is also 10. The system then forcibly disables the loading animation of the "User Information" domain, removes the signature record of the request from the global request suspension pool, and keeps the version number 10 unchanged. When the user clicks the retry button to initiate the request again, the system performs an increment operation based on version number 10 to generate a new version number 11, ensuring that the retry request has the latest version number, thereby avoiding data processing errors caused by version number conflicts.
[0090] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the intelligent scheduling method based on feature signatures in this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0091] This application also provides an intelligent scheduling system based on feature signatures, please refer to... Figure 6 The signature-based intelligent scheduling system includes: The interception and capture module 10 is used to embed a network request interceptor during the initialization phase of the front-end application to capture network requests sent by the front-end application and response messages returned by the server in both directions. The feature signature module 20 is used to extract the element information of the network request based on preset rules and sort the deep object key values to generate a unique feature signature. The request reuse module 30 is used to query whether there is a request with the same signature in the global request suspension pool. If it exists, the physical sending of the current request is blocked, and the promise object of the current request is bridged to the resolution link of the existing request to achieve logical multiplexing. Version control module 40 is used by the module to allow physical network requests if they do not exist, and to assign a monotonically increasing logical clock version number to the current request and update it to the version control table. The matching processing module 50 is used to obtain the response data and the logical clock version number carried by the interceptor when the server response arrives, match them with the latest version number in the version control table, and execute the matching result.
[0092] The signature-based intelligent scheduling system provided in this application, employing the signature-based intelligent scheduling method described in the above embodiments, can solve the technical problems of existing technologies failing to effectively avoid redundant requests and struggling to resolve data race conditions caused by out-of-order responses. Compared with existing technologies, the beneficial effects of the signature-based intelligent scheduling system provided in this application are the same as those of the signature-based intelligent scheduling method provided in the above embodiments, and other technical features of the signature-based intelligent scheduling system are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0093] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described signature-based intelligent scheduling method. This solves the technical problems of existing technologies, such as the inability to effectively avoid redundant requests and the difficulty in resolving data race conditions caused by out-of-order responses. Compared with existing technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the signature-based intelligent scheduling method provided in the above embodiments, and will not be elaborated upon here.
[0094] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A smart scheduling method based on feature signatures, characterized in that, The method includes: A network request interceptor is embedded during the initialization phase of the front-end application to capture network requests sent by the front-end application and response messages returned by the server in both directions. Extract the element information of the network request based on preset rules and sort it by deep object key value to generate a unique feature signature; Check if there is a request with the same signature in the global request suspension pool. If it exists, block the physical sending of the current request and bridge the promise object of the current request to the resolution chain of the existing request to achieve logical multiplexing. If it does not exist, allow the physical network request and assign a monotonically increasing logical clock version number to the current request, updating the version control table; When the server response arrives, the interceptor obtains the response data and the logical clock version number it carries, matches it with the latest version number in the version control table, and executes the matching result.
2. The intelligent scheduling method based on feature signatures as described in claim 1, characterized in that, The step of extracting the element information of the network request based on preset rules, sorting it by deep object key-value pairs, and generating a unique feature signature includes: Extract the request method, request path, and request payload of the network request; The nested objects in the request payload are sorted lexicographically by deep recursion to eliminate differences in attribute arrangement and obtain a normalized payload. After concatenating the request method, request path, and normalized payload into strings, a fixed-length unique signature is generated using a one-way hash digest algorithm.
3. The intelligent scheduling method based on feature signatures as described in claim 1, characterized in that, The step of bridging the promise object of the current request to the resolution chain of an existing request to achieve logical multiplexing includes: Based on the unique signature, the callback subscription list of existing requests is obtained from the global request suspension pool. The callback subscription list stores the resolution functions of multiple pending commitment objects associated with the existing requests. The resolution function of the commitment object of the current request is appended to the callback subscription list, causing the current request to be suspended and waiting. If the physical response to an existing request arrives and data parsing is completed, the resolution functions in the callback subscription list are called sequentially to distribute the same response data to all pending logical requests, including the current request.
4. The intelligent scheduling method based on feature signatures as described in claim 1, characterized in that, The steps of allowing physical network requests if they do not exist, assigning a monotonically increasing logical clock version number to the current request, and updating the version control table include: Determine the business domain identifier to which the current request belongs; Obtain the current logical clock version number corresponding to the business domain identifier mentioned in the version control table; An increment operation is performed based on the current logical clock version number to generate a new logical clock version number; The new logical clock version number is written back to update the version control table, and the unique signature is stored in the global request suspension pool.
5. The intelligent scheduling method based on feature signatures as described in claim 1, characterized in that, The step of obtaining response data and its carried logical clock version number based on the interceptor, matching it with the latest version number in the version control table, and executing the matching result includes: Compare the logical clock version number carried in the response data with the latest version number of the corresponding business domain in the version control table; If the two are consistent, the response is deemed valid, the response data is parsed and distributed to all pending logical requests through the bridging link; If the logical clock version number carried in the response data is later than the latest version number, the response is determined to be expired, a silent circuit breaker is executed, and the response data is discarded.
6. The intelligent scheduling method based on feature signatures as described in claim 5, characterized in that, The step of executing a silent circuit breaker and discarding the response data includes: The interceptor layer blocks the propagation path of response data to the upper layer application state tree; Return a commitment object that will never be resolved to the front-end application layer, thus blocking the injection of the response data into the application state tree and view layer.
7. The intelligent scheduling method based on feature signatures as described in claim 1, characterized in that, The method also includes a Loading state takeover and synchronization step: The interceptor layer centrally manages the loading status control of each business domain; If the logical clock version number carried in the response data is consistent with the latest version number of the corresponding business domain in the version control table, then a loading status shutdown signal is sent. When a silent circuit breaker is applied to an expired response, the loading state of the corresponding business domain remains unchanged.
8. The intelligent scheduling method based on feature signatures as described in claim 7, characterized in that, The method also includes an anomaly protection step: If an exception occurs in a permitted physical network request, obtain the exception version number of the request that triggered the exception. If the abnormal version number is equal to the latest version number of the corresponding business domain in the version control report, then the loading status of the business domain corresponding to the abnormal request is forcibly reset to closed, and the feature signature directory corresponding to the abnormal request in the global request suspension pool is cleaned up. The version number of the business domain corresponding to the abnormal request is kept from rolling back, ensuring that the version number of the retry request continues to monotonically increase.
9. An intelligent scheduling system based on feature signatures, characterized in that, The signature-based intelligent scheduling system includes: The interception and capture module is used to embed a network request interceptor during the initialization phase of the front-end application, and to capture network requests sent by the front-end application and response messages returned by the server in both directions. The feature signature module is used to extract the element information of the network request based on preset rules and sort the deep object key values to generate a unique feature signature. The request reuse module is used to query whether there is a request with the same signature in the global request suspension pool. If it exists, it blocks the physical sending of the current request and bridges the promise object of the current request to the resolution chain of the existing request to achieve logical multiplexing. The version control module is used by the module to allow physical network requests if they do not exist, and to assign a monotonically increasing logical clock version number to the current request and update it to the version control table. The matching processing module is used to obtain the response data and the logical clock version number carried by the interceptor when the server response arrives, and match it with the latest version number in the version control table, and execute the matching result.
10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the intelligent scheduling method based on feature signatures as described in any one of claims 1 to 8.
