CN113987073A - Method and device for updating state information in delayed mode and electronic equipment - Google Patents

Method and device for updating state information in delayed mode and electronic equipment Download PDF

Info

Publication number
CN113987073A
CN113987073A CN202111257810.1A CN202111257810A CN113987073A CN 113987073 A CN113987073 A CN 113987073A CN 202111257810 A CN202111257810 A CN 202111257810A CN 113987073 A CN113987073 A CN 113987073A
Authority
CN
China
Prior art keywords
delay
task
tasks
time
delayed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111257810.1A
Other languages
Chinese (zh)
Inventor
刘芯达
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Amusement Starcraft Beijing Technology Co ltd
Original Assignee
Amusement Starcraft Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Amusement Starcraft Beijing Technology Co ltd filed Critical Amusement Starcraft Beijing Technology Co ltd
Priority to CN202111257810.1A priority Critical patent/CN113987073A/en
Publication of CN113987073A publication Critical patent/CN113987073A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a method and a device for updating state information in a delayed manner and electronic equipment. The method comprises the following steps: the data synchronization system acquires a delay task to be executed; the data synchronization system determines a delay time corresponding to the delay task according to the execution time and the current time in the delay task, and sends the delay task and the delay time corresponding to the delay task to a message queue; the message queue receives a delay task sent by the data synchronization system and a delay time corresponding to the delay task; the message queue sets corresponding delay time length for the delay task and then adds the delay time length into an expiration time queue; and when any delay task in the expiration time queue reaches the corresponding delay time, the message queue sends the any delay task to a corresponding service system so as to instruct the service system to execute the any delay task to update corresponding state information.

Description

Method and device for updating state information in delayed mode and electronic equipment
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method and an apparatus for updating status information in a delayed manner, and an electronic device.
Background
In some Software as a Service (SaaS) application systems, there are many requirements for a delayed update status. Such as "set user membership status expired after 30 days", "experience value +100 of user after 10 days", etc. In general, a task for performing a delayed update of state information may be referred to as a delayed task, i.e., a task for updating state information is performed at some point in the future.
In the architecture diagram of the existing delayed updating system of the state information as shown in fig. 1, the delayed updating system may include a database for storing the delayed tasks, a data synchronization system for reading the delayed tasks, and a business system for executing the delayed tasks. When the method is implemented, the data synchronization system can periodically read the delay tasks to be executed from the database; after the delay task meets the execution condition (generally, reaches a set future execution time), the delay task is sent to the service system by calling the service system, and the service system executes the delay task to update the state information specified by the delay task. After the service system completes the state information update, the update result can be called back to the data synchronization system, and the data synchronization system modifies the synchronization state of the delay task recorded in the database into synchronized state.
In the related art, after the data synchronization system reads the delay tasks to be executed from the database, the delay tasks usually determine whether the execution conditions are met; therefore, the delay tasks in the data synchronization system are sequentially read by polling, whether the currently read delay task meets the execution condition is judged, and if not, the next delay task is read. For a delayed task that does not satisfy the execution condition, it is necessary to determine again whether the execution condition is satisfied at the next polling read.
However, with the rapid increase of the number of the delay tasks, the time consumed for reading each round of tasks is long, and the delay tasks which are judged not to satisfy the execution conditions before may have already satisfied the execution conditions, but because the next round of task reading has not been performed yet, the data synchronization system cannot read the tasks and cannot execute the tasks, so that the problem that the state information corresponding to the delay tasks is not updated in time is caused.
Disclosure of Invention
The present disclosure provides a method and an apparatus for updating status information in a delayed manner, and an electronic device, so as to at least solve the problem in the related art that the status information cannot be updated timely due to synchronization delay after a condition of delaying update of the status information is reached. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a method for updating status information in a delayed manner, the method including:
the data synchronization system acquires a delay task to be executed;
the data synchronization system determines a delay time corresponding to the delay task according to the execution time and the current time in the delay task, and sends the delay task and the delay time corresponding to the delay task to a message queue;
the message queue receives a delay task sent by the data synchronization system and a delay time corresponding to the delay task;
the message queue sets corresponding delay time length for the delay task and then adds the delay time length into an expiration time queue;
and when any delay task in the expiration time queue reaches the corresponding delay time, the message queue sends the any delay task to a corresponding service system so as to instruct the service system to execute the any delay task to update corresponding state information.
Optionally, the method further includes:
the data synchronization system performs idempotent verification on the delay tasks according to execution information in the delay tasks to be executed so as to determine whether repeated delay tasks exist;
and the data synchronization system performs duplicate removal on repeated delay tasks in the delay tasks to be executed.
Optionally, the data synchronization system performs idempotent verification on the delay task according to the execution information in the delay task to be executed to determine whether there is a repeated delay task, including:
the data synchronization system executes the delay tasks according to the execution information in each delay task, and determines the execution result of each delay task as an idempotent verification result;
the data synchronization system acquires a primary key and an idempotent verification result of each delay task;
the data synchronization system determines the delay tasks with the same primary key and the same idempotent verification result as the repeated delay tasks.
Optionally, the primary key includes information including a task identifier, an execution time, and a user identifier in the deferred task.
Optionally, the method further includes:
and when the message queue fails to send any delay task to the corresponding service system, triggering a retry mechanism, and sending the delay task which fails to be sent to the corresponding service system again.
According to a second aspect of the embodiments of the present disclosure, there is provided a device for updating status information in a delayed manner, including a data synchronization system and a message queue;
the data synchronization system is configured to acquire a delay task to be executed and determine a delay time corresponding to the delay task according to an execution time and a current time in the delay task; sending the delay task and the delay time corresponding to the delay task to a message queue;
the message queue is configured to receive a delay task sent by the data synchronization system and a delay time corresponding to the delay task, set the corresponding delay time for the delay task, and add the delay time into an expiration time queue; and when any delay task in the expiration time queue reaches the corresponding delay time, sending the any delay task to the corresponding service system so as to instruct the service system to execute the any delay task to update the corresponding state information.
Optionally, the data synchronization system is further configured to perform idempotent verification on the delay tasks according to execution information in the delay tasks to be executed to determine whether repeated delay tasks exist, and perform deduplication on the repeated delay tasks in the delay tasks to be executed.
Optionally, the data synchronization system is further configured to execute the delay tasks according to the execution information in each delay task, and determine the execution result of each delay task as an idempotent verification result; and acquiring a main key and an idempotent verification result of each delay task, and determining the delay tasks with the same main key and the same idempotent verification result as repeated delay tasks.
Optionally, the primary key includes information including a task identifier, an execution time, and a user identifier in the deferred task.
Optionally, the message queue is further configured to, when it fails to send any of the delayed tasks to the corresponding service system, trigger a retry mechanism, and send the delayed task that fails to be sent to the corresponding service system again.
According to a third aspect of embodiments of the present disclosure, an electronic device includes:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method for delayed updating of state information of any of the preceding claims.
According to a fourth aspect of embodiments of the present disclosure, a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method for delayed updating of status information according to any one of the preceding claims.
According to a fifth aspect of embodiments of the present disclosure, a computer subsystem product comprises a computer subsystem which, when executed by a processor, implements the method for delayed updating of state information of any of the preceding claims.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the data synchronization system calculates the time difference of the delay tasks to determine the delay time of each delay task, thereby decoupling the premise that the task must be read during the task execution; and then, the delay task does not need to be read in a polling mode, the delay task and the corresponding delay time length only need to be transmitted into the message queue, and the message queue sequentially sends the delay task according to the delay time length based on the opened expiration time queue. Because the delay task does not need to be read by polling once, the time precision of the execution of the delay task can be improved, and the state information corresponding to the delay task is prevented from being updated untimely.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is an architectural diagram illustrating an existing delayed update system for state information, according to an example embodiment.
Fig. 2 is an architectural diagram illustrating an improved delayed update system for state information, according to an example embodiment.
Fig. 3 is a flow chart illustrating a method for delayed updating of state information, according to an example embodiment.
Fig. 4 is a block diagram illustrating a delayed update mechanism for status information according to an example embodiment.
FIG. 5 is a block diagram illustrating an electronic device in accordance with an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The embodiment of the specification provides an improved delayed updating scheme of state information, and aims to solve the problem that the state information corresponding to a delayed task is not updated timely in the related art.
Referring now to fig. 2, fig. 2 is a block diagram illustrating an architecture of an improved delayed update system for state information, according to an example embodiment. At least a database storing deferred tasks, a data synchronization system, a message queue, and a business system may be included in the system.
The data synchronization system may further include a task synchronization subsystem (e.g., the timing synchronization subsystem and the real-time synchronization subsystem in fig. 2), and a task sending subsystem.
The task synchronization subsystem is used for reading a delay task to be executed from the database and sending the delay task to the task sending subsystem according to a preset rule.
Further, the task synchronization subsystem may acquire a to-be-executed deferred task in a current period. The delay tasks to be executed in the current period can be acquired by the timing synchronization subsystem and the real-time synchronization subsystem respectively.
The timing synchronization subsystem can acquire the locally stored delayed tasks to be executed in the current period read from the database in the last period.
The real-time synchronization subsystem can change the monitoring subsystem according to the database and send the delay tasks in the current period newly added in the database to the task sending subsystem in real time.
The timing synchronization subsystem may periodically read data from the database, specifically, read a delay task to be executed in a next cycle of the current cycle from the database, and store the delay task locally. And for the current cycle, the delayed tasks to be executed in the current cycle read from the database in the previous cycle are acquired from the local as described above.
By periodically executing the whole amount of delay tasks, the number of delay tasks executed each time can be reduced under the condition of not missing the delay tasks, and therefore the execution efficiency of the delay tasks is improved.
The task sending subsystem is used for determining a delay time corresponding to the delay task according to the execution time and the current time in the received delay task, and transmitting the delay task and the corresponding delay time into a message queue;
the message queue is opened with a Time-To-Live (TTL) queue. And the message queue is used for setting corresponding delay time for the delay tasks according to the transmitted delay tasks and the corresponding delay time, adding the delay time into an expiration time queue, and sending any delay task to a corresponding service system when any delay task in the expiration time queue reaches the corresponding delay time so as to instruct the service system to execute any delay task to update corresponding state information.
A flowchart of a method for delayed updating of state information is shown below in further connection with an exemplary embodiment provided in fig. 3, the method comprising the steps of:
step 210, the data synchronization system obtains a delay task to be executed.
In this embodiment, the data synchronization system may read the deferred task to be executed from a database storing deferred tasks. But also delayed tasks read from other devices or systems.
In an exemplary embodiment, the data synchronization system may periodically acquire the delay tasks to be executed, and each time a specific data synchronization system acquires the delay tasks to be executed in the current period.
The delay tasks to be executed in the current period may include delay tasks cached locally or delay tasks read from a database in real time.
Specifically, the method comprises the following steps: the task synchronization subsystem may obtain a delayed task to be executed in a current cycle. The delay tasks to be executed in the current period can be acquired by the timing synchronization subsystem and the real-time synchronization subsystem respectively.
The timing synchronization subsystem can acquire the locally stored delayed tasks to be executed in the current period read from the database in the last period.
The real-time synchronization subsystem can change the monitoring subsystem according to the database and read the delay task newly added in the database in the current period in real time.
The timing synchronization subsystem may periodically read data from the database, specifically, read a delay task to be executed in a next cycle of the current cycle from the database, and store the delay task locally. And for the current cycle, the delayed tasks to be executed in the current cycle read from the database in the previous cycle are acquired from the local as described above.
In the example, the whole amount of delay tasks are read and sent in a time-sharing manner through two synchronization manners of real time and timing, so that the situation that the state information corresponding to the delay tasks is not updated timely due to the fact that too many delay tasks are processed at one time is avoided.
This is illustrated below by way of example. And starting a timing synchronization subsystem, reading the delayed tasks to be executed from 24 hours to 48 hours in the future (namely the next period) from the database at 0 hour every day, and locally acquiring the delayed tasks read from the previous day (namely the previous period).
And starting the real-time synchronization subsystem, starting the database change monitoring subsystem, and automatically acquiring a delay task with the execution time within 0-24 of the current day when the delay task is inserted into the database.
Step 220, the data synchronization system determines a delay duration corresponding to the delay task according to the execution time and the current time in the delay task, and sends the delay task and the delay duration corresponding to the delay task to a message queue.
In this embodiment, after the data synchronization system acquires the delay tasks to be executed, the time difference calculation may be performed according to the execution time and the current time in each delay task, so as to determine the delay duration corresponding to each delay task.
The execution time refers to a time at which the task specified in the delayed task is executed later than the future. For example, for a delay task of "setting the user member status to expire after 30 days" triggered after the user charges the member for 1 month, the task sending subsystem may perform time difference calculation according to the execution time of the delay task (assuming to be 9 months, 1 day, 0 hour, 0 minute and 0 second) and the current time (i.e., the time when the task sending subsystem performs time difference calculation, assuming to be 8 months, 31 days, 0 hour, 0 minute and 0 second).
In the time difference calculation process, the execution time and the current time may be encoded, for example, converted into timestamps, where the timestamp of the execution time is 1630425600 and the timestamp of the current time is 1630339200; the execution time minus the current time results in a delay period of 86400 seconds (i.e., 24 hours).
Of course, in some embodiments, the execution time and the current time are obtained in the form of a timestamp, and the encoding process may be omitted.
In practical applications, the same delay task in the database may be repeatedly read, or read by the real-time synchronization subsystem and the timing synchronization subsystem, respectively, so that there is a repeated task in the delay tasks sent to the task sending subsystem.
The occurrence of duplicate tasks may result in the same deferred task being executed repeatedly. For example, for a "block user account for 30 days" delayed task, if there are 2 repeated tasks, the user account would be blocked for 60 days, which is obviously wrong. There is a need to identify and avoid performing repetitive, delayed tasks.
To this end, in an exemplary embodiment, before the step 220, the method may further include:
the data synchronization system performs idempotent verification on the delay tasks according to execution information in the delay tasks to be executed so as to determine whether repeated delay tasks exist;
and the data synchronization system performs duplicate removal on repeated delay tasks in the delay tasks to be executed.
Correspondingly, the step 220 includes determining a delay duration corresponding to the delay task for the execution time and the current time of the remaining delay tasks after the deduplication, and sending the delay task and the delay duration corresponding to the delay task to the message queue.
The idempotent verification means that when different requests are executed respectively, if the same execution result is obtained, the different requests conform to idempotent, that is, the idempotent verification passes. In the present embodiment, the idempotent check is used to execute each delayed task separately, and if there are delayed tasks with identical execution results, it indicates that such delayed tasks belong to a duplicate task.
According to the result of idempotent verification, the delay tasks with the identical execution results are subjected to deduplication, and the rest delay tasks can be regarded as different delay tasks, so that the subsequent steps can be continued.
Through the embodiment, the repeated delay tasks are found by utilizing idempotent verification, and after the repeated delay tasks are deduplicated, the abnormal state updating caused by the execution of the repeated delay tasks can be avoided.
In an exemplary embodiment, the above data synchronization system performs idempotent verification on the delay task according to the execution information in the delay task to be executed to determine whether there is a duplicate delay task, including:
the data synchronization system executes the delay tasks according to the execution information in each delay task, and determines the execution result of each delay task as an idempotent verification result;
the data synchronization system acquires a main key and an idempotent verification result of each delay task;
the data synchronization system determines the delay tasks with the same primary key and the same idempotent verification result as the repeated delay tasks.
The primary key may include information including other unique data such as a task identifier, an execution time, and/or a user identifier in the deferred task.
In practical applications, there may be different deferred tasks of the same task content, and such beliefs may be referred to as the same task. The same task is different from the repeated task in that although the same task has the same content, the same task corresponds to a different task; the repeated tasks have the same task content and correspond to the same task.
For example, 2 different wind control systems of the platform simultaneously perform a delay task of blocking a user account for 30 days aiming at the illegal operation of the same user; then although the task contents of the 2 delayed tasks are identical, the tasks are derived from different wind control systems and therefore should not be regarded as repetitive tasks.
Therefore, when performing the idempotent check, different delay tasks can be identified by using the primary key of the delay task as unique information, and only the delay tasks with the same primary key and the same execution result are determined to be the repeated delay tasks.
Step 230, the message queue receives the delay task sent by the data synchronization system and the delay duration corresponding to the delay task.
In this embodiment, the Message Queue (MQ) employed needs to support the time-out queue (TTL), e.g., a RabbitMQ may be employed.
The message queue is used for receiving the delay task to be executed and the delay time length corresponding to the delay task, which are sent by the data synchronization system.
Step 240, the message queue sets a corresponding delay duration for the delay task and then adds the delay duration into an expiration time queue.
The message queue can set an expiration time (i.e., the delay time) for the delay task in the opened TTL queue, so that the TTL queue does not directly consume the delay task after receiving the delay task, but defers until the delay time is reached, and then delivers the delay task to the corresponding service system for consumption.
In the embodiment, the cooperation of the time difference calculation and the TTL is equivalent to time-sorting the delay tasks once; the execution time is sequenced from front to back, so that the delay tasks do not need to be read once, and only the delay tasks are sent in sequence according to the delay time.
Step 250, the message queue sets a corresponding delay time length for the delay task and then adds the delay time length into an expiration time queue. And when any delay task in the expiration time queue reaches the corresponding delay time, the message queue sends the any delay task to a corresponding service system so as to instruct the service system to execute the any delay task to update corresponding state information.
In this embodiment, the service system corresponding to the delay task may refer to a service system specified in the delay task, and since different delay tasks are different for different service systems, the corresponding service system, for example, a service system identifier, needs to be written when the delay task is generated. Therefore, when the TTL queue sends the delay task, the delay task can be routed to a corresponding service system based on the service system identification, so that the delay task is sent to the service system. When the service system receives the deferred task, authenticity check is generally required to determine whether the deferred task is legitimate and authentic, so as to avoid executing illegal deferred tasks.
In general, the authenticity check may include checking a digital signature of the deferred task, the digital signature may include a digital signature of a system triggering generation of the deferred task, and may also include digital signatures of a database, a task synchronization system, a message queue, and the like in the deferred task streaming process.
The digital signature may be an electronic signature generated based on an asymmetric encryption technique. Specifically, each business entity may generate a pair of public and private keys based on an asymmetric encryption algorithm, the private key may be used for signature encryption of business data (such as deferred tasks), and the public key may be used for signature decryption of the business data.
In the embodiment, each member involved in the delayed task flow process may use its own private key to sign and encrypt the handed delayed task, and the service system that needs to execute the delayed task may use the public key that is externally disclosed by each member to sign and verify the delayed task. If each digital signature is successfully verified, the authenticity verification aiming at the digital signature is passed, and the business system can execute the delay task; otherwise, as long as any one digital signature fails to be checked, the authenticity check is not passed, the service system cannot execute the delay task, and the delay task is discarded as a waste task.
In practical applications, the authenticity check may include a deferred task integrity check to determine whether the content of the deferred task has been tampered with, in addition to the check of the digital signature. The general integrity check can be performed by calculating a digital digest, that is, when the delay task is generated, a digital digest based on the content of the delay task is calculated once and the digital digest is circulated with the delay task. During integrity check, calculating the digital abstract based on the delayed task content again; if the two digital digests are consistent, the content of the delayed task is not tampered, namely the integrity check is passed; otherwise, if the two digital excerpts are not consistent, the content of the delayed task is tampered, that is, the integrity check is not passed, the service system cannot execute the delayed task, and the delayed task is discarded as a waste task.
In this embodiment, after the authenticity check of the received deferred task is passed, the business system may execute the deferred task, so as to update the corresponding state information according to the execution information of the deferred task (including the update content of the specified state information).
In summary, the data synchronization system performs time difference calculation on the delay tasks to determine the delay duration of each delay task, so as to decouple the premise that the task needs to be read during task execution; therefore, the delay tasks do not need to be read in a polling mode, the delay tasks and the corresponding delay time length only need to be transmitted into the expiration time queue opened by the message queue, and the delay tasks are sequentially transmitted by the expiration time queue according to the delay time length. Because the delay task does not need to be read by polling once, the time precision of the execution of the delay task can be improved, and the state information corresponding to the delay task is prevented from being updated untimely.
In an exemplary embodiment, the method may further include:
and when the message queue fails to send any delay task to the corresponding service system, triggering a retry mechanism, and sending the delay task which fails to be sent to the corresponding service system again.
In the embodiment, through the TTL delay queue of the message queue, when the delay tasks in the queue reach the preset delay duration, the delay tasks can be automatically sent to the service system; and the consumption of the service system is ensured not to be interfered by network jitter to the maximum extent by a retry mechanism (the retry times can be flexibly set, for example, 3 times) of the message queue, and the fault tolerance of the system is improved.
In correspondence with the foregoing embodiment of the method for updating the status information with a delay time shown in fig. 3, the present specification also provides an embodiment of the apparatus for updating the status information with a delay time shown in fig. 4. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software.
Fig. 4 is a block diagram of a delayed updating apparatus of state information corresponding to the foregoing fig. 3, including a data synchronization system 310 and a message queue 320;
the data synchronization system 310 is configured to acquire a delay task to be executed, and determine a delay duration corresponding to the delay task according to an execution time and a current time in the delay task; sending the delay task and the delay time corresponding to the delay task to a message queue;
the message queue 320 is configured to receive the delay task sent by the data synchronization system and the delay time corresponding to the delay task, set the corresponding delay time for the delay task, and add the delay time into an expiration time queue; and when any delay task in the expiration time queue reaches the corresponding delay time, sending the any delay task to the corresponding service system so as to instruct the service system to execute the any delay task to update the corresponding state information.
In an exemplary implementation, the data synchronization system 310 is further configured to perform an idempotent validation on the delayed tasks according to the execution information in the delayed tasks to be executed to determine whether there are repeated delayed tasks, and perform a deduplication on the repeated delayed tasks in the delayed tasks to be executed.
In an exemplary implementation, the data synchronization system 310 is further configured to execute the deferred tasks according to the execution information in each deferred task, and determine the execution result of each deferred task as an idempotent verification result; and acquiring a main key and an idempotent verification result of each delay task, and determining the delay tasks with the same main key and the same idempotent verification result as repeated delay tasks.
In an exemplary implementation, the primary key includes information consisting of a task identifier, an execution time, and a user identifier in the deferred task.
In an exemplary implementation, the message queue 320 is further configured to trigger a retry mechanism when sending any of the delayed tasks to the corresponding service system fails, and send the delayed tasks that failed to be sent to the corresponding service system again.
In an exemplary embodiment, there is also provided a computer subsystem product comprising computer subsystems/instructions that, when executed by a processor, perform the method for delayed updating of state information according to any of the above embodiments.
Fig. 5 is a schematic block diagram illustrating an electronic device in accordance with an embodiment of the present disclosure. Referring to fig. 5, electronic device 400 may include one or more of the following components: processing component 402, memory 404, power component 406, multimedia component 408, audio component 410, input/output (I/O) interface 412, sensor component 414, and communication component 418. The electronic device described above may employ a similar hardware architecture.
The processing component 402 generally controls overall operation of the electronic device 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or a portion of the steps of the method for generating a three-dimensional avatar described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 can include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
The memory 404 is configured to store various types of data to support operations at the electronic device 400. Examples of such data include instructions for any application subsystem or method operating on the electronic device 400, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 404 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 406 provides power to the various components of the electronic device 400. Power components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 400.
The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 400 is in an operating mode, such as a shooting mode or a video mode. Each of the front camera and the rear camera may be a fixed or optical lens system with a focal length and optical zoom capability.
The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 400 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in memory 404 or transmitted via communications component 418. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
The I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be keyboards, click wheels, options, and the like. These options may include, but are not limited to: a home option, a volume option, a start option, and a lock option.
The sensor component 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 may detect an open/closed state of the electronic device 400, the relative positioning of components, such as a display and keypad of the electronic device 400, the sensor assembly 414 may also detect a change in the position of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, orientation or acceleration/deceleration of the electronic device 400, and a change in the temperature of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communication component 418 is configured to facilitate wired or wireless communication between electronic device 400 and other devices. The electronic device 400 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 4G), or a combination thereof. In an exemplary embodiment, the communication component 418 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 418 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an embodiment of the present disclosure, the electronic device 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components, and is configured to perform the method for updating the status information in a delayed manner according to any of the embodiments.
In an embodiment of the present disclosure, a computer-readable storage medium including instructions, such as the memory 404 including instructions, which are executable by the processor 420 of the electronic device 400 to perform the method for updating the state information with a delay time according to any of the embodiments described above is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for delayed updating of state information, the method comprising:
the data synchronization system acquires a delay task to be executed;
the data synchronization system determines a delay time corresponding to the delay task according to the execution time and the current time in the delay task, and sends the delay task and the delay time corresponding to the delay task to a message queue;
the message queue receives a delay task sent by the data synchronization system and a delay time corresponding to the delay task;
the message queue sets corresponding delay time length for the delay task and then adds the delay time length into an expiration time queue;
and when any delay task in the expiration time queue reaches the corresponding delay time, the message queue sends the any delay task to a corresponding service system so as to instruct the service system to execute the any delay task to update corresponding state information.
2. The method of claim 1, further comprising:
the data synchronization system performs idempotent verification on the delay tasks according to execution information in the delay tasks to be executed so as to determine whether repeated delay tasks exist;
and the data synchronization system performs duplicate removal on repeated delay tasks in the delay tasks to be executed.
3. The method of claim 2, wherein the data synchronization system performs idempotent verification on the delayed tasks according to the execution information in the delayed tasks to be executed to determine whether repeated delayed tasks exist, and the method comprises the following steps:
the data synchronization system executes the delay tasks according to the execution information in each delay task, and determines the execution result of each delay task as an idempotent verification result;
the data synchronization system acquires a primary key and an idempotent verification result of each delay task;
the data synchronization system determines the delay tasks with the same primary key and the same idempotent verification result as the repeated delay tasks.
4. The method of claim 3, wherein the primary key comprises information consisting of a task identifier, an execution time, and a user identifier in the deferred task.
5. The method of claim 1, further comprising:
and when the message queue fails to send any delay task to the corresponding service system, triggering a retry mechanism, and sending the delay task which fails to be sent to the corresponding service system again.
6. The device for updating the state information in a delayed way is characterized by comprising a data synchronization system and a message queue;
the data synchronization system is configured to acquire a delay task to be executed and determine a delay time corresponding to the delay task according to an execution time and a current time in the delay task; sending the delay task and the delay time corresponding to the delay task to a message queue;
the message queue is configured to receive a delay task sent by the data synchronization system and a delay time corresponding to the delay task, set the corresponding delay time for the delay task, and add the delay time into an expiration time queue; and when any delay task in the expiration time queue reaches the corresponding delay time, sending the any delay task to the corresponding service system so as to instruct the service system to execute the any delay task to update the corresponding state information.
7. The apparatus of claim 6, wherein the data synchronization system is further configured to perform an idempotent validation on the delayed tasks according to the execution information in the delayed tasks to be executed to determine whether there are repeated delayed tasks, and perform a deduplication on the repeated delayed tasks in the delayed tasks to be executed.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of delayed updating of state information according to any of claims 1-5.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method for delayed updating of state information of any of claims 1-5.
10. A computer subsystem product comprising a computer subsystem, characterized in that the computer subsystem when executed by a processor implements the method for delayed updating of state information according to any of claims 1-5.
CN202111257810.1A 2021-10-27 2021-10-27 Method and device for updating state information in delayed mode and electronic equipment Pending CN113987073A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111257810.1A CN113987073A (en) 2021-10-27 2021-10-27 Method and device for updating state information in delayed mode and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111257810.1A CN113987073A (en) 2021-10-27 2021-10-27 Method and device for updating state information in delayed mode and electronic equipment

Publications (1)

Publication Number Publication Date
CN113987073A true CN113987073A (en) 2022-01-28

Family

ID=79742778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111257810.1A Pending CN113987073A (en) 2021-10-27 2021-10-27 Method and device for updating state information in delayed mode and electronic equipment

Country Status (1)

Country Link
CN (1) CN113987073A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114629580A (en) * 2022-05-17 2022-06-14 阿里巴巴达摩院(杭州)科技有限公司 Low-orbit satellite link simulation method and device and electronic equipment
CN114844844A (en) * 2022-04-25 2022-08-02 平安普惠企业管理有限公司 Delay message processing method, device, equipment and storage medium
CN115601195A (en) * 2022-10-17 2023-01-13 桂林电子科技大学(Cn) Transaction bidirectional recommendation system and method based on real-time label of power user

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114844844A (en) * 2022-04-25 2022-08-02 平安普惠企业管理有限公司 Delay message processing method, device, equipment and storage medium
CN114629580A (en) * 2022-05-17 2022-06-14 阿里巴巴达摩院(杭州)科技有限公司 Low-orbit satellite link simulation method and device and electronic equipment
CN115601195A (en) * 2022-10-17 2023-01-13 桂林电子科技大学(Cn) Transaction bidirectional recommendation system and method based on real-time label of power user
CN115601195B (en) * 2022-10-17 2023-09-08 桂林电子科技大学 Transaction bidirectional recommendation system and method based on real-time label of power user

Similar Documents

Publication Publication Date Title
CN113987073A (en) Method and device for updating state information in delayed mode and electronic equipment
CN107169125B (en) Multimedia resource delivery statistical data acquisition method and device
KR102337170B1 (en) Blockchain-based transaction processing method and apparatus, and electronic device
CN110688254B (en) Data synchronization method and device, electronic equipment and storage medium
CN106713127B (en) Method and device for acquiring and processing instant chat records
CN111431724B (en) Data transmission method and device and electronic equipment
CN111199039B (en) Application security verification method and device and terminal equipment
CN108989062B (en) Method, device, terminal, system and storage medium for updating group member data
CN114721710A (en) Version control method, version control device and storage medium
CN107733674B (en) Component upgrading method and terminal
CN106375350B (en) Flashing verification method and device
CN112087411B (en) System, method and device for authorization processing and electronic equipment
CN112163046A (en) Block chain-based equipment data storage method, device and system
CN110245523B (en) Data verification method, system and device and computer readable storage medium
CN116579890A (en) Online signing system based on block chain
CN112883314B (en) Request processing method and device
CN109948012B (en) Serial number generation method and device and storage medium
CN106874793B (en) Database processing method and device
CN112434339A (en) Information processing method and device
CN114884663B (en) Multimedia object processing method, device, equipment and storage medium
CN110995767B (en) Request processing method and device
CN114221788B (en) Login method, login device, electronic equipment and storage medium
CN112016928B (en) Payment method and device and payment device
US11061778B2 (en) Restoration of a messaging application
CN116821234A (en) Data synchronization method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination