CN114691379A - Service control method, device, electronic equipment and storage medium - Google Patents

Service control method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114691379A
CN114691379A CN202011610930.0A CN202011610930A CN114691379A CN 114691379 A CN114691379 A CN 114691379A CN 202011610930 A CN202011610930 A CN 202011610930A CN 114691379 A CN114691379 A CN 114691379A
Authority
CN
China
Prior art keywords
target service
offline
service
accessed
determining
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
CN202011610930.0A
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.)
Guoxinjunhe Beijing Technology Co ltd
Original Assignee
Guoxinjunhe 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 Guoxinjunhe Beijing Technology Co ltd filed Critical Guoxinjunhe Beijing Technology Co ltd
Priority to CN202011610930.0A priority Critical patent/CN114691379A/en
Publication of CN114691379A publication Critical patent/CN114691379A/en
Pending legal-status Critical Current

Links

Images

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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • 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
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

The embodiment of the invention relates to a service control method, a service control device, electronic equipment and a storage medium, wherein the method comprises the following steps: after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, if an access request for the target service is received, calling the target service; and determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, wherein the offline notification message is used for indicating that the target service is about to be offline. Therefore, the real caller of the target service can know that the target service is about to be offline in time.

Description

Service control method, device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a service control method, a service control device, electronic equipment and a storage medium.
Background
In practice, the services provided by a service provider typically have a certain life cycle, i.e. it typically involves taking a normally online service offline. When the service needs to be offline, if the offline processing is directly performed, a sudden error occurs on the service caller. To avoid this, the prior art proposes: when the service needs to be offline, the offline plan of the service, such as offline time, is disclosed in advance through a business notification or announcement mode, so that a service caller can know that the called service is offline in time, and corresponding processing measures are taken to avoid self errors caused by the offline of the service.
However, in practice, not all service providers have perfect business notification flows, nor all service invokers can know the offline plan of the service in the bulletin period, which results in that the service invokers cannot know that the invoked service is offline in time, so that the service invokers can make mistakes themselves because the invoked service is offline without knowing.
Disclosure of Invention
In view of this, in order to solve the technical problem that the service caller cannot know that the called service is about to be offline in time, embodiments of the present invention provide a service control method, apparatus, electronic device, and storage medium.
In a first aspect, an embodiment of the present invention provides a service control method, where the method includes:
after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, if an access request for the target service is received, calling the target service; and the number of the first and second groups,
and determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, wherein the offline notification message is used for indicating that the target service is about to be offline.
In a possible embodiment, the offline instruction carries a predetermined offline time of the target service;
the determining that the target service meets the set offline condition includes:
when the preset offline time is reached, acquiring a history record of the access of the target service;
determining whether the target service is accessed within a set historical time period according to the historical record, wherein the historical time period is a time period with a set time length before the preset offline time;
when the target service is determined not to be accessed within the historical time period, determining that the target service meets a set offline condition;
the method further comprises the following steps:
and when the target service is determined to be accessed within the historical time period, determining that the target service does not meet the set offline condition.
In one possible embodiment, in the case that the determination is that the target service was accessed within the historical time period, the method further comprises:
periodically judging whether the target service is accessed or not according to a set rule from the preset offline time; when the current period is finished, judging whether the target service is accessed in the current period;
if the judgment result is yes, determining that the target service does not meet the offline condition, and continuing to judge when the next period is finished; otherwise, the judgment is terminated, and the target service is determined to meet the set offline condition.
In one possible embodiment, the method further comprises;
and if the target service is accessed in a plurality of periods and the accumulated time length of the periods reaches a set threshold value, determining that the target service meets the set offline condition.
In one possible embodiment, the method further comprises:
recording a first mark for the target service when a offline instruction for the target service is received;
recording a second mark for the target service when the preset offline time is reached and the target service is determined to be accessed within a set historical time period;
if receiving an access request to the target service, invoking the target service, including:
when an access request to the target service is received, if the first mark is determined to be recorded, calling the target service according to an original mode;
and when receiving an access request to the target service, if the second mark is determined to be recorded, delaying to invoke the target service according to a set delay rule.
In one possible embodiment, the method further comprises:
when the target service is determined to meet the set offline condition, the target service is offline;
and after the target service is offline, if an access request to the target service is received, discarding the access request.
In a second aspect, an embodiment of the present invention provides a service control apparatus, where the apparatus includes:
the service calling module is used for calling the target service if an access request for the target service is received after a offline instruction for the target service is received and before the target service is determined to meet the set offline condition;
the identity determination module is used for determining the current service calling party based on the access request;
and the message sending module is used for sending an offline notification message of the target service to the service calling party, wherein the offline notification message is used for indicating that the target service is about to be offline.
In one possible embodiment, the offline instruction carries a predetermined offline time of the target service; the device further comprises:
the first determining module is used for acquiring the accessed historical record of the target service when the preset offline time is reached; determining whether the target service is accessed within a set historical time period according to the historical record, wherein the historical time period is a time period with a set time length before the preset offline time; when the target service is determined not to be accessed within the historical time period, determining that the target service meets a set offline condition; and when the target service is determined to be accessed within the historical time period, determining that the target service does not meet the set offline condition.
In one possible embodiment, the apparatus further comprises:
the second determining module is used for periodically judging whether the target service is accessed or not according to a set rule from the preset offline time; when the current period is finished, judging whether the target service is accessed in the current period; if the judgment result is yes, determining that the target service does not meet the offline condition, and continuing to judge when the next period is finished; otherwise, the judgment is terminated, and the target service is determined to meet the set offline condition.
In one possible embodiment, the apparatus further comprises:
and the third determining module is used for determining that the target service meets the set offline condition if the target service is accessed in a plurality of periods and the accumulated time length of the periods reaches the set threshold value.
In one possible embodiment, the apparatus further comprises:
the second recording module is used for recording a first mark for the target service when receiving a offline instruction aiming at the target service;
a third recording module, configured to record a second flag for the target service when the predetermined offline time is reached and it is determined that the target service is accessed within a set historical time period;
the service calling module is specifically configured to:
when an access request for the target service is received, if the first mark is determined to be recorded, calling the target service according to an original mode;
and when receiving an access request to the target service, if the second mark is determined to be recorded, delaying to invoke the target service according to a set delay rule.
In one possible embodiment, the apparatus further comprises:
the offline module is used for offline the target service when the target service is determined to meet the set offline condition;
and the discarding module is used for discarding the access request if the access request to the target service is received after the target service is offline.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a processor and a memory, the processor being configured to execute a service control program stored in the memory to implement the service control method of any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the service control method according to any one of the first aspects.
According to the technical scheme provided by the embodiment of the invention, after the offline instruction aiming at the target service is received, the target service is still kept online until the target service is determined to meet the set offline condition, so that the target service has a certain offline transition period, and the smooth offline of the target service is realized; after receiving the offline instruction for the target service and before determining that the target service meets the set offline condition, if receiving an access request for the target service, determining the current service caller based on the access request, and sending an offline notification message for indicating that the target service is to be offline to the service caller, so that the real caller of the target service can know that the target service is about to be offline in time, and therefore corresponding processing measures can be taken in time, and self errors caused by service offline are avoided.
Drawings
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present invention;
fig. 2 is a flowchart of an embodiment of a service control method according to an embodiment of the present invention;
fig. 3 is a flowchart of another embodiment of a service control method according to an embodiment of the present invention;
fig. 4 is a block diagram of an embodiment of a service control apparatus according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a schematic view of an application scenario provided in the embodiment of the present invention is shown.
In the application scenario illustrated in fig. 1, the service provider 101 may provide one or more services, which may be integrated on a server or a server cluster (only one server is taken as an example in fig. 1) in practice, and may be invoked by one or more invokers (hereinafter referred to as service invokers). The service invoker may include an application, system, process, thread, etc., and the invocation may include a synchronous invocation or an asynchronous invocation.
In practice, the service invoker illustrated above takes the electronic device as a carrier, and therefore, in the application scenario illustrated in fig. 1, the service invoker is represented by the electronic device. Such electronic devices include, but are not limited to: smart phones, tablets, laptop portable computers, desktop computers, servers, etc., three desktop computers 102-104 are exemplified in fig. 1.
Further, in practice, the services provided by the service provider 101 typically have a certain life cycle, which in practice may result in the need to take the service off-line due to technology upgrades or other factors. When the service needs to be offline, if offline processing is directly performed, a sudden error occurs to a service caller, and in order to avoid the occurrence of the condition, the prior art proposes: when the service needs to be offline, the offline plan of the service, such as offline time, is disclosed in advance through a business notification or announcement mode, so that a service caller can know that the called service is offline in time, and corresponding processing measures are taken to avoid self errors caused by the offline of the service.
However, in practice, not all service providers have perfect business notification flows, nor all service invokers can know the offline plan of the service in the bulletin period, which results in that the service invokers cannot know that the invoked service is offline in time, so that the service invokers can make mistakes themselves because the invoked service is offline without knowing.
To solve the above problem, an embodiment of the present invention provides a service control method. The service control method provided by the present invention is further explained with specific embodiments in the following with reference to the drawings, and the embodiments do not limit the embodiments of the present invention.
Referring to fig. 2, a flowchart of an embodiment of a service control method according to an embodiment of the present invention is provided. In one example, the method may be applied to the service provider 101 illustrated in fig. 1, and as shown in fig. 2, the method may include the steps of:
step 201, after receiving the offline instruction for the target service and before determining that the target service meets the set offline condition, if an access request for the target service is received, calling the target service.
The target service refers to a service needing offline.
In one embodiment, the down command for the target service may be sent to the service provider 101 by the operation and maintenance personnel of the target service. As an optional implementation manner, the operation and maintenance staff may select the target service through a visual interface provided by the terminal device, and trigger the terminal device to generate a offline instruction for the target service, and further, the terminal device sends the generated offline instruction to the service provider 101, so that the service provider 101 receives the offline instruction for the target service.
As can be seen from the description in step 201, in the embodiment of the present invention, after receiving the offline instruction for the target service, the service provider 101 does not directly offline the target service, but determines whether the target service meets the set offline condition. That is, the service provider 101 keeps the target service online after receiving the offline instruction for the target service and before determining that the target service satisfies the set offline condition. Based on this, after receiving the offline instruction for the target service and before determining that the target service meets the set offline condition, if the access request for the target service is received, the target service can still be called to provide the target service for the service caller corresponding to the access request.
How to determine whether the target service meets the set offline condition is explained in the flow shown in fig. 3 below, which is not repeated here.
Step 202, determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, where the offline notification message is used to indicate that the target service is about to be offline.
As can be seen from the above description in step 202, in the embodiment of the present invention, after the offline instruction for the target service is received and before it is determined that the target service meets the set offline condition, if an access request for the target service is received, in addition to invoking the target service to provide the target service to the service invoker corresponding to the access request, the identity of the service invoker of this time is determined based on the access request, and then an offline notification message for indicating that the target service is going offline is sent to the service invoker. Further, as an embodiment, after receiving the offline notification message, the service caller may record the offline notification message into the program log at a warning level, so that the operation and maintenance personnel of the service caller can know that the target service is about to be offline from the program log, and then take corresponding processing measures in time, thereby avoiding an error caused by the offline service.
As an embodiment, the offline notification message may carry the offline time of the target service, so that the real caller of the target service can know the offline time of the target service.
As another embodiment, the offline notification message may also carry service recommendation information, such as a recommendation that the service invoker use some other service to replace the target service, so that the real invoker of the target service can know other available services.
As an embodiment, in practice, determining the identity of the service invoker based on the access request may be implemented based on an identity verification technology, such as a HMAC (Hash-based Message Authentication Code) algorithm. Specifically, in the HMAC algorithm, the access request may carry an AppKey, and the AppKey may uniquely represent the identity of the service caller.
According to the technical scheme provided by the embodiment of the invention, after the offline instruction aiming at the target service is received, the target service is still kept online until the target service is determined to meet the set offline condition, so that the target service can have a certain offline transition period, and the smooth offline of the target service is realized; after the offline instruction for the target service is received and before the target service is determined to meet the set offline condition, if the access request for the target service is received, the current service caller is determined based on the access request, and an offline notification message used for indicating that the target service is offline is sent to the service caller, so that the real caller of the target service can know that the target service is about to be offline in time, corresponding processing measures can be taken in time, and self errors caused by offline of the service are avoided.
Referring to fig. 3, a flowchart of another service control method according to an embodiment of the present invention is provided, where the flowchart shown in fig. 3 describes a detailed process from receiving a logoff instruction for a target service to logoff the target service based on the flowchart shown in fig. 2, and may include the following steps:
and 301, when an offline instruction for the target service is received, keeping the target service online.
Step 302, when the preset offline time is reached, acquiring a history record of the accessed target service, and determining whether the target service is accessed within a set history time period according to the history record; if so, keeping the target service online and executing step 303; if not, step 305 is performed.
Step 303, periodically judging whether the target service is accessed according to a set rule from a preset offline time, wherein when the current period is ended, judging whether the target service is accessed in the current period; if so, go to step 304; if not, step 305 is performed.
Step 304, determining whether the target service is accessed in a plurality of periods, and the accumulated time length of the plurality of periods reaches a set threshold value; if so, step 305 is performed, and if not, the target service is kept online and the process returns to step 303.
And 305, determining that the target service meets the set offline condition.
Steps 301 to 305 are explained in a unified manner as follows:
in the embodiment of the present invention, the offline command may carry a predetermined offline time of the target service, where the predetermined offline time is a certain time point in the future, for example, the service provider receives the offline command for the target service at 10 am of 1 st of 10 months in 2019, and the predetermined offline time carried by the offline command is 10 am of 3 th of 10 months in 2019. Based on this, the service provider 101 does not directly take the target service off line but keeps the target service on line when receiving the off line instruction for the target service.
Next, as shown in step 302, when the scheduled offline time is reached, the service provider 101 does not directly offline the target service, but determines whether the target service meets the set offline condition, specifically, obtains a history record of the visited target service, and determines whether the target service was visited within a set history time period according to the history record, where the history time period is a current time, that is, a time period before the scheduled offline time and having a set time duration, for example, a time period from 10 am 10 pm in 10 month 2 in 2019 to 10 am 10 in 3 month 3 in 2019.
If the target service is accessed within the set historical time period, it means that the target service is still in use, at this time, if the target service is taken off line, the normal operation of the service caller will be affected, so if it is determined that the target service is accessed within the set historical time period, the target service is kept on line, and step 303 is executed.
On the contrary, if the target service is not accessed within the set historical time period, it means that the target service is not used, and at this time, if the target service is taken off line, the service caller will not be affected, so that if it is determined that the target service is not accessed within the set historical time period, step 305 may be executed to determine that the target service meets the set offline condition.
Further, in the case that it is determined that the target service has been accessed within the set historical time period, as described in step 303, from the scheduled offline time, it is periodically determined whether the target service has been accessed according to the set rule, and specifically, at the end of the current period, it is determined whether the target service has been accessed within the current period. If the determination result indicates that the target service has not been accessed in the current period, it means that the target service is not used, and at this time, if the target service is taken off line, the service caller is not affected, so that if it is determined that the target service has not been accessed in the current period, step 305 may be executed to determine that the target service meets the set offline condition. On the contrary, if the judgment result indicates that the target service is accessed in the current period, it means that the target service is still in use.
Further, as described in step 304, in the case that the above-mentioned determination result indicates that the target service has been accessed in the current period, it is not directly determined to keep the target service online, but it is continuously determined whether the target service has been accessed in a plurality of periods, and the accumulated time length of the plurality of periods has reached the set threshold. If yes, it means that the target service needs to be forced to be offline currently, so step 305 is executed, if no, step 303 may be returned to, and at the end of the next period, it is continuously determined whether the target service has been accessed. Therefore, the target service can not be offline under the condition that the target service is continuously used.
For example, assuming that the predetermined offline time is 10 am on 3 th m in 2019, the cycle duration is 24 hours, and the set threshold is 72 hours, according to the above description, when 10 am on 4 th m in 2019, it is determined whether the target service has been accessed within a period of time from 10 am on 3 th m in 10 th m in 2019 to 10 am on 4 th m in 10 th m in 2019, and if not, it is determined that the target service satisfies the set offline condition.
If the target service is accessed within the period from 10 am on day 3 of month 10 of 2019 to 10 am on day 4 of month 10 of 2019, the target service is maintained online because it is accessed only during one period at this time. When 10 am on 5 th of 10 th of 2019 is reached, whether the target service is accessed within the period from 10 am on 4 th of 10 th of 4 th of 2019 to 10 am on 5 th of 10 th of 2019 is judged, and if not, the target service is determined to meet the set offline condition.
If the target service is accessed within the period from 10 am on 4 th month in 2019 to 10 am on 5 th month in 2019, the target service is still kept online because the target service is accessed in two periods, the accumulated time of the two periods is 48 hours, and the set threshold is not reached for 72 hours. When 10 am on 5 th of 10 th of 2019 is reached, whether the target service is accessed within the period from 10 am on 4 th of 10 th of 4 th of 2019 to 10 am on 5 th of 10 th of 2019 is judged, and if not, the target service is determined to meet the set offline condition.
If the target service is accessed within the period from 10 am on day 4 of 2019 to 10 am on day 5 of 2019, it is determined that the target service satisfies the set offline condition because the target service has been accessed in three periods and the accumulated time of the three periods has reached 72 hours.
And step 306, taking the target service off line.
And when the target service is determined to meet the set offline condition, the target service can be offline.
As an embodiment, when the target service is offline, an offline notification event for indicating that the target service is offline can be sent to the outside, so that operation and maintenance personnel of the target service can know that the target service is offline. The offline notification event can be a message reminding event in various forms, such as a text reminding event, a voice reminding event, an optical signal reminding event, and the like.
Further, after taking the target service offline, if an access request for the target service is received, the access request may be discarded.
As can be seen from the flow shown in fig. 3, according to the technical solution provided by the embodiment of the present invention, whether the target service is offline is determined according to the actual used condition of the target service, so that an error of a service caller still using the target service due to the offline of the target service can be effectively avoided, and the target service has a certain offline transition period, thereby achieving smooth offline of the target service; in the whole service offline process, the service provider only needs to trigger the operation of generating the offline instruction for the target service once, so that compared with the prior art of disclosing the offline plan of the target service in a business notification or bulletin mode, the operation of the service provider is greatly simplified, and the automatic smooth offline of the service is realized.
In addition, as an embodiment, the offline time may be predetermined as a node, and the service status of the target service may be distinguished. Specifically, before the scheduled offline time is reached, if an access request for the target service is received, the target service may be called in an original manner, where the original manner is a normal calling manner for the target service. After the predetermined offline time is reached and before the target service is determined to meet the set offline condition, if an access request for the target service is received, the calling of the target service may be delayed according to a set delay rule, for example, the calling of the target service is delayed by 1.5 seconds. By this processing, the service caller can feel the service performance degradation of the target service, and can possibly predict that the target service is going to be off-line.
As an optional implementation manner, when a offline instruction for the target service is received, a first flag is recorded for the target service, and similarly, when the scheduled offline time is reached, if it is determined that the target service has been accessed within the set historical time period, a second flag is recorded for the target service. In this way, when an access request for the target service is received, if it is determined that the first mark for the target service is recorded, it means that the scheduled offline time is not reached currently, and at this time, based on the above description, the target service is called in the original manner. When receiving an access request to the target service, if determining that the second mark of the target service is recorded, the second mark means that the preset offline time is reached currently, and based on the above description, the target service is delayed to be called according to the set delay rule.
In addition, under the condition of keeping the target service online, when an access request to the target service is received, the access time of the service caller to the target service at this time is recorded. The history of the accessed target service can be formed, so that the determination of whether the target service is accessed in the set historical time period/any period according to the history of the accessed target service is realized.
Referring to fig. 4, a block diagram of an embodiment of a service control apparatus according to an embodiment of the present invention is provided. As shown in fig. 4, the apparatus includes:
the service invoking module 41 is configured to, after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, invoke the target service if an access request for the target service is received;
an identity determination module 42, configured to determine a current service invoker based on the access request;
a message sending module 43, configured to send an offline notification message of the target service to the service caller, where the offline notification message is used to indicate that the target service is about to be offline.
In a possible embodiment, the offline instruction carries a predetermined offline time of the target service; the device further comprises (not shown in fig. 4):
the first determining module is used for acquiring the accessed historical record of the target service when the preset offline time is reached; determining whether the target service is accessed within a set historical time period according to the historical record, wherein the historical time period is a time period with a set time length before the preset offline time; when the target service is determined not to be accessed within the historical time period, determining that the target service meets a set offline condition; and when the target service is determined to be accessed within the historical time period, determining that the target service does not meet the set offline condition.
In a possible embodiment, the device further comprises (not shown in fig. 4):
the second determining module is used for periodically judging whether the target service is accessed or not according to a set rule from the preset offline time; when the current period is finished, judging whether the target service is accessed in the current period; if the judgment result is yes, determining that the target service does not meet the offline condition, and continuing to judge when the next period is finished; otherwise, the judgment is terminated, and the target service is determined to meet the set offline condition.
In a possible embodiment, the device further comprises (not shown in fig. 4):
and the third determining module is used for determining that the target service meets the set offline condition if the target service is accessed in a plurality of periods and the accumulated time length of the periods reaches the set threshold value.
In a possible embodiment, the device further comprises (not shown in fig. 4):
the second recording module is used for recording a first mark for the target service when a offline instruction aiming at the target service is received;
a third recording module, configured to record a second flag for the target service when the predetermined offline time is reached and it is determined that the target service is accessed within a set historical time period;
the service invoking module 41 is specifically configured to:
when an access request for the target service is received, if the first mark is determined to be recorded, calling the target service according to an original mode;
and when receiving an access request to the target service, if the second mark is determined to be recorded, delaying to invoke the target service according to a set delay rule.
In a possible embodiment, the device further comprises (not shown in fig. 4):
the offline module is used for offline the target service when the target service is determined to meet the set offline condition;
and the discarding module is used for discarding the access request if the access request to the target service is received after the target service is offline.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 500 shown in fig. 5 includes: at least one processor 501, memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together by a bus system 505. It is understood that the bus system 505 is used to enable connection communications between these components. The bus system 505 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 505 in FIG. 5.
The user interface 503 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball (trackball), a touch pad or touch screen, etc.
It is to be understood that the memory 502 in embodiments of the present invention may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (PROM), an erasable programmable Read-only memory (erasabprom, EPROM), an electrically erasable programmable Read-only memory (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM) which functions as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (staticiram, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (syncronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM ), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and direct memory bus RAM (DRRAM). The memory 502 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 502 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof: an operating system 5021 and application programs 5022.
The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application 5022 includes various applications, such as a media player (MediaPlayer), a Browser (Browser), and the like, for implementing various application services. The program for implementing the method according to the embodiment of the present invention may be included in the application program 5022.
In the embodiment of the present invention, by calling a program or an instruction stored in the memory 502, specifically, a program or an instruction stored in the application 5022, the processor 501 is configured to execute the method steps provided by the method embodiments, for example, including:
after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, if an access request for the target service is received, calling the target service; and the number of the first and second groups,
and determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, wherein the offline notification message is used for indicating that the target service is about to be offline.
The method disclosed by the above-mentioned embodiments of the present invention may be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in software form in the processor 501. The processor 501 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the method in combination with the hardware.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processing units may be implemented within 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), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be the electronic device shown in fig. 5, and may perform all the steps of the service control method shown in fig. 2 to 3, so as to achieve the technical effect of the service control method shown in fig. 2 to 3, and for brevity, please refer to the description related to fig. 2 to 3, which is not described herein again.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the service control method executed on the electronic device side as described above is realized.
The processor is configured to execute the service control program stored in the memory to implement the following steps of the service control method executed on the electronic device side:
after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, if an access request for the target service is received, calling the target service; and the number of the first and second groups,
and determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, wherein the offline notification message is used for indicating that the target service is about to be offline.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for service control, the method comprising:
after receiving a offline instruction for a target service and before determining that the target service meets a set offline condition, if an access request for the target service is received, calling the target service; and the number of the first and second groups,
and determining the current service caller based on the access request, and sending an offline notification message of the target service to the service caller, wherein the offline notification message is used for indicating that the target service is about to be offline.
2. The method of claim 1, wherein the down-line instruction carries a predetermined down-time for the target service; the determining that the target service meets the set offline condition includes:
when the preset offline time is reached, acquiring a history record of the access of the target service;
determining whether the target service is accessed within a set historical time period according to the historical record, wherein the historical time period is a time period with a set time length before the preset offline time;
when the target service is determined not to be accessed within the historical time period, determining that the target service meets a set offline condition;
the method further comprises the following steps:
and when the target service is determined to be accessed within the historical time period, determining that the target service does not meet the set offline condition.
3. The method of claim 2, wherein in the event that the determination is that the target service was accessed within the historical period of time, the method further comprises:
periodically judging whether the target service is accessed or not according to a set rule from the preset offline time; when the current period is finished, judging whether the target service is accessed in the current period;
if the judgment result is yes, determining that the target service does not meet the offline condition, and continuing to judge when the next period is finished; otherwise, the judgment is terminated, and the target service is determined to meet the set offline condition.
4. The method of claim 3, further comprising:
and if the target service is accessed in a plurality of periods and the accumulated time length of the periods reaches a set threshold value, determining that the target service meets the set offline condition.
5. The method of claim 2, further comprising:
recording a first mark for the target service when a offline instruction for the target service is received;
recording a second mark for the target service when the preset offline time is reached and the target service is determined to be accessed within a set historical time period;
if receiving an access request to the target service, invoking the target service, including:
when an access request for the target service is received, if the first mark is determined to be recorded, calling the target service according to an original mode;
and when receiving an access request to the target service, if the second mark is determined to be recorded, delaying to invoke the target service according to a set delay rule.
6. The method according to any one of claims 1 to 5, further comprising:
when the target service is determined to meet the set offline condition, the target service is offline;
and after the target service is offline, if an access request to the target service is received, discarding the access request.
7. A service control apparatus, characterized in that the apparatus comprises:
the service calling module is used for calling the target service if an access request for the target service is received after a offline instruction for the target service is received and before the target service is determined to meet the set offline condition;
the identity determination module is used for determining the current service calling party based on the access request;
and the message sending module is used for sending an offline notification message of the target service to the service calling party, wherein the offline notification message is used for indicating that the target service is about to be offline.
8. The apparatus of claim 7, wherein the down command carries a predetermined down time for the target service; the device further comprises:
the first determining module is used for acquiring the accessed historical record of the target service when the preset offline time is reached; determining whether the target service is accessed within a set historical time period according to the historical record, wherein the historical time period is a time period with a set time length before the preset offline time; when the target service is determined not to be accessed within the historical time period, determining that the target service meets a set offline condition; and when the target service is determined to be accessed within the historical time period, determining that the target service does not meet the set offline condition.
9. An electronic device, comprising: a processor and a memory, the processor being configured to execute a service control program stored in the memory to implement the service control method of any one of claims 1 to 6.
10. A storage medium storing one or more programs executable by one or more processors to implement the service control method of any one of claims 1 to 6.
CN202011610930.0A 2020-12-30 2020-12-30 Service control method, device, electronic equipment and storage medium Pending CN114691379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011610930.0A CN114691379A (en) 2020-12-30 2020-12-30 Service control method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011610930.0A CN114691379A (en) 2020-12-30 2020-12-30 Service control method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114691379A true CN114691379A (en) 2022-07-01

Family

ID=82132566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011610930.0A Pending CN114691379A (en) 2020-12-30 2020-12-30 Service control method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114691379A (en)

Similar Documents

Publication Publication Date Title
US9836363B2 (en) Semi-automatic failover
US11695842B2 (en) Managing operation of instances
CN110399241B (en) Task exception handling method, device, computer equipment and readable storage medium
CN115981898A (en) Error-correctable error processing method, device and equipment for memory and readable storage medium
CN114143327B (en) Cluster resource quota allocation method and device and electronic equipment
CN110069217B (en) Data storage method and device
CN111782440A (en) Data processing method and device and electronic equipment
CN108563774B (en) GPS data processing method and device
CN111400087B (en) Control method of operating system, terminal and storage medium
US11243979B1 (en) Asynchronous propagation of database events
CN114691379A (en) Service control method, device, electronic equipment and storage medium
CN110908824A (en) Fault identification method, device and equipment
US20220276901A1 (en) Batch processing management
CN111835513B (en) Method, device and equipment for updating certificate data
CN110955647A (en) Database assistance method, database assistance device, computer equipment and storage medium
CN110908792B (en) Data processing method and device
US10686645B1 (en) Scalable subscriptions for virtual collaborative workspaces
US11762809B2 (en) Scalable subscriptions for virtual collaborative workspaces
US9600508B1 (en) Data layer service availability
US11847629B1 (en) Resilient workflows dependent on external computing systems
CN114879916B (en) Method and device for managing storage unit
US20230305892A1 (en) Performance protected autonomous application management for distributed computing systems
US20210208809A1 (en) Coordinated storage media verification
CN113094158A (en) Service drive calling method, service drive calling device, electronic equipment and storage medium
CN116910123A (en) Container task query method, device, 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