CN112817666B - Timing method, timing device, electronic equipment and storage medium - Google Patents

Timing method, timing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112817666B
CN112817666B CN202110112435.5A CN202110112435A CN112817666B CN 112817666 B CN112817666 B CN 112817666B CN 202110112435 A CN202110112435 A CN 202110112435A CN 112817666 B CN112817666 B CN 112817666B
Authority
CN
China
Prior art keywords
timing
target
time
task
message
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.)
Active
Application number
CN202110112435.5A
Other languages
Chinese (zh)
Other versions
CN112817666A (en
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network 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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202110112435.5A priority Critical patent/CN112817666B/en
Publication of CN112817666A publication Critical patent/CN112817666A/en
Application granted granted Critical
Publication of CN112817666B publication Critical patent/CN112817666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • 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/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the disclosure provides a timing method, a timing device, electronic equipment and a storage medium. The method comprises the following steps: when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time; respectively executing the target timing tasks through at least two preset timing components; and when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of reaching the target time. According to the technical scheme, the timing is carried out through the at least two timing components, the situation that the timing components are abnormal and are not reminded or the reminding time is inaccurate can be avoided, the deviation between the time of sending the notification to the calling party and the target time is reduced, and the accuracy of the actual triggering time of the calling party is improved.

Description

Timing method, timing device, electronic equipment and storage medium
Technical Field
The embodiment of the disclosure relates to the technical field of timing, in particular to a timing method, a timing device, electronic equipment and a storage medium.
Background
Currently, many services in application software are implemented by relying on a timing technology, for example, a notification is sent to a user every 10 am, news is pushed to the user every 12 am, and the like, and the services needing to be timed need to set a trigger time for the services in advance, and when the trigger time is reached, the services are notified, so that the services send a message to the user through software, mail, or the like. The prior art generally meets the timing requirements of different services by way of a message queue component sending a delayed message.
However, there is often a large delay in the timing manner of sending the delayed message through the message queue component, resulting in lower accuracy of the actual trigger time of the service that needs to be timed.
Disclosure of Invention
The embodiment of the disclosure provides a timing method, a timing device, electronic equipment and a storage medium, so as to improve the accuracy of the actual triggering time of a service needing to be timed.
In a first aspect, embodiments of the present disclosure provide a timing method, including:
when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time;
Respectively executing the target timing tasks through at least two preset timing components;
and when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of reaching the target time.
In a second aspect, embodiments of the present disclosure further provide a timing device, including:
the task construction module is used for constructing a target timing task according to timing parameters carried in a timing request when the timing request sent by a calling party is received, wherein the timing parameters comprise target time;
the task execution module is used for respectively executing the target timing tasks through at least two preset timing components;
and the notification module is used for sending an arrival notification carrying the timing parameter to the calling party when the target timing task is executed, so as to notify the calling party of the arrival of the target time.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the timing methods as described in embodiments of the present disclosure.
In a fourth aspect, the disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a timing method as described in the disclosed embodiments.
According to the timing method, the device, the electronic equipment and the storage medium, when a timing request sent by a calling party is received, a target timing task is built according to target time carried in the timing request, the target timing task is executed through at least two preset timing components respectively, and when the execution of the target timing task is completed, an arrival notification carrying the timing time is sent to the calling party so as to notify the calling party of arrival of the target time. According to the technical scheme, the timing is carried out through the at least two timing components, the situation that the timing components are abnormal and are not reminded or the reminding time is inaccurate can be avoided, the deviation between the time of sending the notification to the calling party and the target time is reduced, and the accuracy of the actual triggering time of the calling party is improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of a timing method according to an embodiment of the disclosure;
FIG. 2 is a flow chart of another timing method provided by an embodiment of the present disclosure;
FIG. 3 is a block diagram of a timing device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a schematic flow chart of a timing method according to an embodiment of the disclosure. The method may be performed by a timing device (e.g., a timing microservice), wherein the device may be implemented in software and/or hardware, may be configured in an electronic device, typically in a server, and is suitable for timing scenarios, particularly for very long time timing scenarios. As shown in fig. 1, the timing method provided in this embodiment may include:
s101, when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time and timing identification information.
The calling party may be a service (including a micro service) for calling the timing micro service, and the service may be a service provided by a user terminal or a server. The target timing task may be a timing task created by the timing microservice for a timing request sent by the caller. The timing request may be understood as a request sent by the caller for requesting the timing micro service to perform timing, where the timing request may carry the target time of the timing, that is, the time of sending the notification message to the caller. In addition, if there are multiple services that need to call the timing microservice to perform timing in the client terminal or the server where the caller is located, or if there are multiple parallel scenarios that need to perform timing in the caller, the timing parameter preferably further includes timing identification information, so that timing requests sent by different callers in the same device (user terminal or server) and/or timing requests sent by the same caller in different scenarios are distinguished by the timing identification information, where the identification information may be identification information of the caller or corresponding scenario. The following description will take an example in which the timing parameter includes a target time and timing identification information for distinguishing timing requests sent by different callers in the same device.
In this embodiment, the timing microservices can be deployed and operated independently, and other services with timing requirements can be communicated with the timing microservices to meet the requirements of timing triggering. The communication mode of the timing micro service and other services can be selected according to the need, and the communication mode can be preferably realized based on remote procedure call (Remote Procedure Call, RPC) of go language, so that the access cost of the timing micro service used by the other services is reduced, the coupling between the timing micro service and the other services is reduced, and the convenience of later maintenance is further improved.
Illustratively, when there is a timing requirement, the caller generates a timing request carrying a timing parameter of the present timing, and sends the timing request to the RPC communication interface of the timing microservice; correspondingly, the timing micro-service receives the timing request sent by the calling party through the RPC communication interface of the timing micro-service, analyzes the timing request to obtain the timing parameter carried in the timing request, and creates a target timing task with the triggering time as the target time in the timing parameter according to the timing parameter.
S102, respectively executing the target timing tasks through at least two preset timing components.
Wherein the timing component may be a component that can be used for timing, which may be a component in a timing microservice, such as a local timing component (i.e., a local timing component); or may be a component deployed outside of the timing microservice, such as a message queue component. Executing the target timing task by a certain timing component may be understood as timing the target time corresponding to the target timing task by the timing component, for example, setting the timing time of the timing component to the target time, so that the timing component sends out the reminding message when the current time reaches the target time.
In this embodiment, a plurality of timing components may be preset for the timing server, and accordingly, the timing micro-service may execute the target timing task through the plurality of timing components after the target task is built, so as to avoid situations that the timing component is not reminded or the timing component is reminded in a time when the timing component only performs timing through one timing component is not enough, which may occur when the timing component reaches the target time, thereby improving accuracy of an actual trigger time when the timing micro-service triggers a caller to execute a subsequent operation (such as sending a notification or pushing news to a user) corresponding to the timing request.
Taking the execution of the timing task by the local timing component and the message queue component as an example, the timing micro-service can call the local timing component and the message queue component to respectively time after the construction of the target timing task is completed, and set the reminding time of the local timing component and the message queue component as the target time so as to control the local timing component and the message queue component to send the reminding message when the target time is reached.
And S103, when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of the arrival of the target time.
Wherein the timing microservice may determine that the target timing task is performed when the target timing task is performed by the at least one timing component.
In this embodiment, the timing microservice may periodically detect whether each timing component performs the completion of the target timing task, that is, determine whether each timing component sends a reminder message for reminding the current time of reaching the target time, and when detecting that there is a timing component performing the completion of the target task, determine that the target task is completed, and generate an arrival notification (such as a callback message) carrying a timing parameter carried in the timing request, so as to notify the caller that the current time reaches the target time through the arrival notification.
Correspondingly, after receiving the arrival notification sent by the timing micro-service, the caller can judge whether the arrival notification is a call notification returned by the timing micro-service for the timing request sent by the caller according to the timing identification information carried in the arrival notification, and directly execute preset follow-up operations (such as sending the notification or pushing news to the user) when determining that the arrival notification is the call notification returned by the timing micro-service for the timing request sent by the caller; after determining that the timing micro-service is a call notification returned by the timing micro-service for the timing request sent by the calling party, the method can further acquire the target time in the arrival notification, judge whether the deviation value of the current time and the target time is smaller than a preset deviation threshold value, and execute preset follow-up operation only when judging that the deviation value is smaller than the preset deviation threshold value, wherein the follow-up operation can be specific depending on the execution strategy of the calling party.
According to the timing method provided by the embodiment, when a timing request sent by a calling party is received, a target timing task is built according to target time carried in the timing request, the target timing task is executed through at least two preset timing components respectively, and when the execution of the target timing task is completed, an arrival notification carrying the timing time is sent to the calling party so as to notify the calling party of the arrival of the target time. According to the technical scheme, the timing is carried out through the at least two timing components, the situation that the timing components are abnormal and are not reminded or the reminding time is inaccurate can be avoided, the deviation between the time of sending the notification to the calling party and the target time is reduced, and the accuracy of the actual triggering time of the calling party is improved.
Fig. 2 is a schematic flow chart of another timing method provided by an embodiment of the disclosure, where the solution in this embodiment may be combined with one or more alternatives of the above embodiments. Optionally, before the target timing tasks are executed by the preset at least two timing components respectively, the method further includes: judging whether the residual time length is smaller than or equal to the preset time length, wherein the residual time length is the time length of the interval between the current first time and the target time; the step of executing the target timing tasks through at least two preset timing components respectively comprises the following steps: and if the remaining time length is smaller than or equal to the preset time length, executing the target timing task through at least two preset timing components respectively.
Optionally, the timing component is a message queue component or a local timing component, and the executing the target timing task through at least two preset timing components respectively includes: sending a first delay message carrying the target time to a message queue component so that the message queue component returns a first reminding message when the target time is reached; and starting a local timing component to enable the local timing component to generate a second reminding message when the target time is reached.
Optionally, the timing method provided in this embodiment further includes: and when the reminding message is acquired for the first time, determining that the target timing task is executed, wherein the reminding message comprises the first reminding message or the second reminding message.
Optionally, the timing method provided in this embodiment further includes: if the remaining time length is greater than the preset time length, a second delay message carrying a second time is sent to a message queue component, so that the message queue component returns a third reminding message at the second time, and the preset time length is spaced between the second time and the first time; and receiving a third reminding message sent by the message queue component, and returning to execute the operation of judging whether the residual time length is smaller than or equal to the preset time length.
Optionally, before the target timing tasks are executed by the preset at least two timing components respectively, the method further includes: storing target task information of the target timing task into a database so as to reconstruct the target timing task according to the target task information when the target timing task is abnormal; after the sending of the arrival notification carrying the timing parameter to the caller, further comprising; and deleting the target task information stored in the database.
Accordingly, as shown in fig. 2, the timing method provided in this embodiment includes:
s201, when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time;
s202, storing target task information of the target timing task into a database, so as to reconstruct the target timing task according to the target task information when the target timing task is abnormal.
The target task information may be understood as task information of a target timing task, which may include task identification information of the target timing task and timing parameters according to which the target timing task is generated, that is, timing parameters carried in a timing request sent by a caller.
Because the execution time of the timing task with ultra-long time (i.e. the time interval between the time of sending the timing request and the target time carried in the timing request is longer) is longer, and the longer the execution time is, the greater the probability of occurrence of abnormality of the timing task in the running process is, therefore, in this embodiment, after the construction of the target timing task is completed, the target task information of the target timing task can be stored in the database, so that when the abnormality occurs in the target timing task, the timing micro-service can reconstruct the target timing task according to the target task information stored in the database, thereby ensuring that the target timing task must be executed and completed, i.e. ensuring the reliability of the target timing task, and avoiding the situation that the caller is notified when the timing micro-service does not reach the target time due to the occurrence of abnormality in the target timing task.
The timing micro-service can periodically detect whether the target timing task is abnormal in the execution process after the target timing task is created, acquire target task information of the target timing task from a database when the target timing task is detected to be abnormal, reconstruct the target timing task according to the target task information, and control at least two preset timers to continuously execute the reconstructed target timing task.
In this embodiment, when the timing micro service has a plurality of timing tasks (including a target timing task) being executed, the timing micro service may detect whether each timing task is abnormal during the running process at the same time or at different times. In view of the convenience of detection, it is preferable that the timing microservice can detect whether each timing task is abnormal in the running process at the same time, and at this time, the timing method provided in this embodiment may further include: periodically acquiring task information stored in a database, wherein the task information comprises the target task information; and reconstructing the timing task according to the task information if the timing task corresponding to the task information is abnormal according to each piece of task information.
S203, judging whether the remaining time length is smaller than or equal to the preset time length, if not, executing S204, and if so, executing S206, wherein the remaining time length is the time length of the interval between the current first time and the target time.
The preset time length may be any time length of preset longest time duration of single timing of each timing component, preferably may be the smallest time duration of the longest time durations of single timing of each timing component, so as to reduce the total time number of each timing component when executing the target timing task, for example, assuming that the timing micro-service is provided with a message queue component and a local timing component, the longest time duration of single timing of the message queue is 7 days, and the longest time duration of single timing of the local timing component is 10 days, the preset time length may be set to 7 days. The current first time may be understood as the time value at which the timing micro-service calculates the remaining time of the target timing task.
In this embodiment, the local timing component may be restarted to perform timing synchronously only when the target time is reached, for example, when the message queue component is called for timing last time, so that the operation required by the timing micro-service when executing the target timing task is reduced on the premise of ensuring the accuracy of the trigger time of the timing micro-service trigger caller to execute the subsequent operation.
Specifically, the target micro service may acquire a current first time, calculate a difference between the first times of the target time as a remaining time length of the target timing task, and determine whether the remaining time length is less than or equal to a preset time length.
S204, sending a second delay message carrying a second time to a message queue component so that the message queue component returns a third reminding message at the second time, and the preset time length is reserved between the second time and the first time.
S205, receiving a third reminding message sent by the message queue component, and returning to execute S203.
The message queue can be realized based on the RocketMQ, and when the total timing time of the timing tasks is longer than the maximum timing time of the message queue, the timing can be performed by calling the message queue for a certain timing mode every preset time length, so that the timing of any time length is realized. The second delay message may be used to instruct the message queue component to return a third alert message at a second time.
When the remaining time of the target timing task is determined to be greater than the preset time length, determining a second time according to the first time and the preset time, generating a second delay message carrying the second time, and sending the second delay message to the message queue component so as to instruct the message queue component to send a third reminding message to the self-timing micro-service when the second delay message reaches the second time; correspondingly, after receiving the second delay message, the message queue component can judge whether the current time reaches the second time according to a preset strategy (e.g. periodically), and send a third reminding message to the timing microserver when judging that the current time reaches the second time; when the timing micro service receives the third alert message sent by the message queue component, it can determine that the current time reaches the second time, and returns to execute S203.
S206, sending a first delay message carrying the target time to a message queue component and starting a local timing component, so that the message queue component returns a first reminding message when the target time is reached, and the local timing component generates a second reminding message when the target time is reached.
The local timing component may be a Golang language-based timing computation program, among other things, that may be configured within the timing microservice and provide short-term timing computation capabilities for the timing microservice. The first delayed message may be used to instruct the message queue component to return the first alert message at the target time.
The timing micro-service generates a first delay message carrying a target time when determining that the remaining time of the target timing task is less than or equal to a preset time length, sends the first delay message to the message queue component, indicates the message queue component to send a first reminding message to the local timing micro-service when reaching the target time through the first delay message, and starts the local timing component, and sets the reminding time of the local timing component as the target time so that the local timing component generates a second reminding message when reaching the target time; correspondingly, the message queue component/local timing component judges whether the current time reaches the target time according to a corresponding judgment strategy, and returns a first reminding message/second reminding message to the timing micro-service when the current time reaches the preset time; the timing micro-service can send an arrival time notification to the caller when the reminding message is acquired for the first time.
S207, when the reminding message is acquired for the first time, determining that the target timing task is completed, and sending an arrival notification carrying the timing parameter to the calling party so as to inform the calling party of reaching the target time, wherein the reminding message comprises the first reminding message or the second reminding message.
Because the timing delays of the different timing components may be different, in this embodiment, the timing microservice may further reduce the deviation between the actual time when the timing microservice notifies the caller to reach the target time and the target time when the alert message is received for the first time, that is, when at least one timing component in the plurality of timing components determines that the current time reaches the target time, that is, the arrival time notification is sent to the caller, so as to improve the accuracy of the actual trigger time of the caller.
S208, deleting the target task information stored in the database.
In this embodiment, after the timing micro service sends the arrival notification to the caller that sends the timing request, that is, after the timing request processing is completed, the target task information of the target timing task may be deleted from the database, so as to avoid a situation that the target timing task for the timing request is created again based on the target task information stored in the database.
According to the timing method provided by the embodiment, after the target timing task is established, the target task information of the target timing task is stored in the database, and the local timing component is started for timing only when the message queue component is called for the last time, so that the accuracy of the triggering time of the calling party can be improved; the timing of any time length can be supported, the reliability of timing of the timing micro-service is improved, and the operation required by the timing micro-service in the process of executing the timing task is simplified.
Fig. 3 is a block diagram of a timing device according to an embodiment of the present disclosure. The apparatus may be implemented in software and/or hardware, may be configured in an electronic device, typically in a server, and may be timed by performing a timing method provided by an embodiment of the present disclosure. As shown in fig. 3, the timing device provided in this embodiment may include: a task construction module 301, a task execution module 302, and a notification module 303, wherein,
the task construction module 301 is configured to, when a timing request sent by a caller is received, construct a target timing task according to a timing parameter carried in the timing request, where the timing parameter includes a target time;
A task execution module 302, configured to execute the target timing tasks through at least two preset timing components respectively;
and the notification module 303 is configured to send an arrival notification carrying the timing parameter to the caller when the target timing task is executed, so as to notify the caller of reaching the target time.
According to the timing method provided by the embodiment, when a timing request sent by a calling party is received through a task construction module, a target timing task is constructed according to target time carried in the timing request, at least two preset timing components are controlled to respectively execute the target timing task through a task execution module, and when the execution of the target timing task is completed through a notification module, an arrival notification carrying the timing time is sent to the calling party so as to notify the calling party of the arrival of the target time. According to the technical scheme, the timing is carried out through the at least two timing components, the situation that the timing components are abnormal and are not reminded or the reminding time is inaccurate can be avoided, the deviation between the time of sending the notification to the calling party and the target time is reduced, and the accuracy of the actual triggering time of the calling party is improved.
Optionally, the timing device provided in this embodiment further includes: the time length judging module is used for judging whether the residual time length is smaller than or equal to the preset time length before the target timing tasks are respectively executed through the preset at least two timing components, wherein the residual time length is the time length of the interval between the current first time and the target time; the task execution module 302 is configured to: and if the remaining time length is smaller than or equal to the preset time length, executing the target timing task through at least two preset timing components respectively.
Optionally, the timing component is a message queue component or a local timing component, and the task execution module 302 includes: the message sending unit is used for sending a first delay message carrying the target time to the message queue component so that the message queue component returns a first reminding message when the target time is reached; and a timing starting unit, configured to start a local timing component, so that the local timing component generates a second alert message when the target time is reached.
Optionally, the timing device provided in this embodiment further includes: the task determining module is used for determining that the target timing task is executed when the reminding message is acquired for the first time, and the reminding message comprises the first reminding message or the second reminding message.
Optionally, the timing device provided in this embodiment further includes: the message sending module is used for sending a second delay message carrying a second time to the message queue component when the remaining time length is greater than the preset time length, so that the message queue component returns a third reminding message at the second time, and the preset time length is reserved between the second time and the first time; and the message receiving module is used for receiving the third reminding message sent by the message queue component and returning a duration judging template.
Optionally, the timing device provided in this embodiment further includes: the information storage module is used for storing target task information of the target timing task into a database before the target timing task is executed respectively through at least two preset timing components, so that when the target timing task is abnormal, the target timing task is reconstructed according to the target task information; and the information deleting module is used for deleting the target task information stored in the database after the arrival notification carrying the timing parameter is sent to the calling party.
Optionally, the timing device provided in this embodiment further includes: the information acquisition module is used for periodically acquiring each task information stored in the database, wherein the task information comprises the target task information; and the task reconstruction module is used for reconstructing the timing task according to the task information if the timing task corresponding to the task information is abnormal aiming at each piece of task information.
The timing device provided by the embodiment of the disclosure can execute the timing method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of executing the timing method. Technical details not described in detail in this embodiment can be found in the timing method provided by any embodiment of the present disclosure.
Referring now to fig. 4, a schematic diagram of an electronic device (e.g., server) 400 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 4, the electronic device 400 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage means 406 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
In general, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 406 including, for example, magnetic tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 shows an electronic device 400 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communications device 409, or from storage 406, or from ROM 402. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 401.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time; respectively executing the target timing tasks through at least two preset timing components; and when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of reaching the target time.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the name of the module does not constitute a limitation of the unit itself in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In accordance with one or more embodiments of the present disclosure, example 1 provides a timing method comprising:
when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time;
respectively executing the target timing tasks through at least two preset timing components;
and when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of reaching the target time.
According to one or more embodiments of the present disclosure, example 2 further includes, before the performing the target timing tasks by the at least two timing components set in advance, respectively, according to the method of example 1:
judging whether the residual time length is smaller than or equal to the preset time length, wherein the residual time length is the time length of the interval between the current first time and the target time;
the step of executing the target timing tasks through at least two preset timing components respectively comprises the following steps:
and if the remaining time length is smaller than or equal to the preset time length, executing the target timing task through at least two preset timing components respectively.
According to one or more embodiments of the present disclosure, example 3 the method of example 1 or 2, the timing component is a message queue component or a local timing component, the performing the target timing task by at least two timing components set in advance, respectively, includes:
sending a first delay message carrying the target time to a message queue component so that the message queue component returns a first reminding message when the target time is reached; the method comprises the steps of,
and starting a local timing component to enable the local timing component to generate a second reminding message when the target time is reached.
According to one or more embodiments of the present disclosure, example 4 is the method of example 3, further comprising:
and when the reminding message is acquired for the first time, determining that the target timing task is executed, wherein the reminding message comprises the first reminding message or the second reminding message.
According to one or more embodiments of the present disclosure, example 5 the method of example 2, further comprising:
if the remaining time length is greater than the preset time length, a second delay message carrying a second time is sent to a message queue component, so that the message queue component returns a third reminding message at the second time, and the preset time length is spaced between the second time and the first time;
And receiving a third reminding message sent by the message queue component, and returning to execute the operation of judging whether the residual time length is smaller than or equal to the preset time length.
According to one or more embodiments of the present disclosure, example 6, according to the method of example 1, before the performing the target timing tasks by the at least two timing components set in advance, respectively, further includes:
storing target task information of the target timing task into a database so as to reconstruct the target timing task according to the target task information when the target timing task is abnormal;
after the sending of the arrival notification carrying the timing parameter to the caller, further comprising;
and deleting the target task information stored in the database.
According to one or more embodiments of the present disclosure, example 7 the method of example 6, further comprising:
periodically acquiring task information stored in a database, wherein the task information comprises the target task information;
and reconstructing the timing task according to the task information if the timing task corresponding to the task information is abnormal according to each piece of task information.
Example 8 provides a timing device according to one or more embodiments of the present disclosure, comprising:
the task construction module is used for constructing a target timing task according to timing parameters carried in a timing request when the timing request sent by a calling party is received, wherein the timing parameters comprise target time;
the task execution module is used for respectively executing the target timing tasks through at least two preset timing components;
and the notification module is used for sending an arrival notification carrying the timing parameter to the calling party when the target timing task is executed, so as to notify the calling party of the arrival of the target time.
Example 9 provides an electronic device according to one or more embodiments of the present disclosure, comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the timing method as described in any of examples 1-7.
In accordance with one or more embodiments of the present disclosure, example 10 provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the timing method of any of examples 1-7.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (8)

1. A timing method, comprising:
when a timing request sent by a calling party is received, a target timing task is constructed according to timing parameters carried in the timing request, wherein the timing parameters comprise target time;
respectively executing the target timing tasks through at least two preset timing components;
when the target timing task is executed, sending an arrival notification carrying the timing parameter to the calling party so as to notify the calling party of reaching the target time;
the timing component is a message queue component or a local timing component, and the target timing task is executed by at least two preset timing components respectively, including:
sending a first delay message carrying the target time to a message queue component so that the message queue component returns a first reminding message when the target time is reached; the method comprises the steps of,
Starting a local timing component to enable the local timing component to generate a second reminding message when the target time is reached;
the method further comprises the steps of:
and when the reminding message is acquired for the first time, determining that the target timing task is executed, wherein the reminding message comprises the first reminding message or the second reminding message.
2. The method of claim 1, further comprising, prior to said executing said target timing tasks by said at least two preset timing components, respectively:
judging whether the residual time length is smaller than or equal to the preset time length, wherein the residual time length is the time length of the interval between the current first time and the target time;
the step of executing the target timing tasks through at least two preset timing components respectively comprises the following steps:
and if the remaining time length is smaller than or equal to the preset time length, executing the target timing task through at least two preset timing components respectively.
3. The method as recited in claim 2, further comprising:
if the remaining time length is greater than the preset time length, a second delay message carrying a second time is sent to a message queue component, so that the message queue component returns a third reminding message at the second time, and the preset time length is spaced between the second time and the first time;
And receiving a third reminding message sent by the message queue component, and returning to execute the operation of judging whether the residual time length is smaller than or equal to the preset time length.
4. The method of claim 1, further comprising, prior to said executing said target timing tasks by said at least two preset timing components, respectively:
storing target task information of the target timing task into a database so as to reconstruct the target timing task according to the target task information when the target timing task is abnormal;
after the sending of the arrival notification carrying the timing parameter to the caller, further comprising;
and deleting the target task information stored in the database.
5. The method as recited in claim 4, further comprising:
periodically acquiring task information stored in a database, wherein the task information comprises the target task information;
and reconstructing the timing task according to the task information if the timing task corresponding to the task information is abnormal according to each piece of task information.
6. A timing device, comprising:
The task construction module is used for constructing a target timing task according to timing parameters carried in a timing request when the timing request sent by a calling party is received, wherein the timing parameters comprise target time;
the task execution module is used for respectively executing the target timing tasks through at least two preset timing components;
the notification module is used for sending an arrival notification carrying the timing parameter to the calling party when the target timing task is executed, so as to notify the calling party of the arrival of the target time;
wherein the timing component is a message queue component or a local timing component, and the task execution module comprises: the message sending unit is used for sending a first delay message carrying the target time to the message queue component so that the message queue component returns a first reminding message when the target time is reached; and a timing starting unit, configured to start a local timing component, so that the local timing component generates a second alert message when the target time is reached;
the apparatus further comprises: the task determining module is used for determining that the target timing task is executed when the reminding message is acquired for the first time, and the reminding message comprises the first reminding message or the second reminding message.
7. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the timing method of any of claims 1-5.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the timing method according to any of claims 1-5.
CN202110112435.5A 2021-01-27 2021-01-27 Timing method, timing device, electronic equipment and storage medium Active CN112817666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110112435.5A CN112817666B (en) 2021-01-27 2021-01-27 Timing method, timing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110112435.5A CN112817666B (en) 2021-01-27 2021-01-27 Timing method, timing device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112817666A CN112817666A (en) 2021-05-18
CN112817666B true CN112817666B (en) 2023-07-21

Family

ID=75859694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110112435.5A Active CN112817666B (en) 2021-01-27 2021-01-27 Timing method, timing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112817666B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933687A (en) * 2017-03-13 2017-07-07 武汉斗鱼网络科技有限公司 Timing method, device and electronic equipment
CN108255515A (en) * 2018-01-17 2018-07-06 广州汇智通信技术有限公司 A kind of method and apparatus for realizing timer service
WO2019033855A1 (en) * 2017-08-16 2019-02-21 北京京东尚科信息技术有限公司 Method and device for providing message alert
CN109634730A (en) * 2018-11-26 2019-04-16 平安科技(深圳)有限公司 Method for scheduling task, device, computer equipment and storage medium
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment
WO2019174129A1 (en) * 2018-03-13 2019-09-19 平安科技(深圳)有限公司 Event reminder method, apparatus, computer device, and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020104067A1 (en) * 1999-12-29 2002-08-01 Green David W. Method and system and article of manufacture for an N-tier software component architecture application
US8627317B2 (en) * 2010-03-25 2014-01-07 International Business Machines Corporation Automatic identification of bottlenecks using rule-based expert knowledge
CN110245008B (en) * 2018-03-09 2023-02-03 阿里巴巴集团控股有限公司 Timing task processing method, system and equipment
CN110618879B (en) * 2019-08-15 2021-07-30 北京三快在线科技有限公司 Message processing method and device, electronic equipment and computer readable medium
CN112799796A (en) * 2019-11-14 2021-05-14 腾讯科技(深圳)有限公司 Timed task management method, device and storage medium
CN110955583A (en) * 2019-12-18 2020-04-03 米哈游科技(上海)有限公司 Notification method and device, electronic equipment and storage medium
CN111562971A (en) * 2020-04-09 2020-08-21 北京明略软件系统有限公司 Scheduling method and system of distributed timer

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933687A (en) * 2017-03-13 2017-07-07 武汉斗鱼网络科技有限公司 Timing method, device and electronic equipment
WO2019033855A1 (en) * 2017-08-16 2019-02-21 北京京东尚科信息技术有限公司 Method and device for providing message alert
CN108255515A (en) * 2018-01-17 2018-07-06 广州汇智通信技术有限公司 A kind of method and apparatus for realizing timer service
WO2019174129A1 (en) * 2018-03-13 2019-09-19 平安科技(深圳)有限公司 Event reminder method, apparatus, computer device, and storage medium
CN109634730A (en) * 2018-11-26 2019-04-16 平安科技(深圳)有限公司 Method for scheduling task, device, computer equipment and storage medium
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment

Also Published As

Publication number Publication date
CN112817666A (en) 2021-05-18

Similar Documents

Publication Publication Date Title
CN111475298B (en) Task processing method, device, equipment and storage medium
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN114090316A (en) Memory fault processing method and device, storage medium and electronic equipment
CN111309747A (en) Data synchronization method, system and device
CN112379982B (en) Task processing method, device, electronic equipment and computer readable storage medium
CN111857858A (en) Method and apparatus for processing information
CN110865846B (en) Application management method, device, terminal, system and storage medium
CN111163336B (en) Video resource pushing method and device, electronic equipment and computer readable medium
CN110336592B (en) Data transmission method suitable for Bluetooth card reader, electronic equipment and storage medium
EP3879795A1 (en) Method and apparatus for acquiring information, device, medium and computer program product
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN110519373B (en) Method and device for pushing information
CN112817666B (en) Timing method, timing device, electronic equipment and storage medium
CN110855655A (en) Information verification method, device, equipment and storage medium
CN113518183B (en) Camera calling method and device and electronic equipment
CN111198853A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN111444457B (en) Data release method and device, storage medium and electronic equipment
CN112883314A (en) Request processing method and device
CN111694679B (en) Message processing method and device and electronic equipment
CN114513548B (en) Directional call information processing method and device
CN110635996B (en) Information display method, device, computer equipment and storage medium
CN116088977A (en) Asynchronous popup window display method, device, equipment and medium
CN113965580A (en) Method and device for synchronizing messages
CN111222947A (en) Processing method and device of delay event, electronic equipment and storage medium
CN114363449A (en) Service state switching method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant