CN111913765A - Data request processing method - Google Patents

Data request processing method Download PDF

Info

Publication number
CN111913765A
CN111913765A CN202010827430.6A CN202010827430A CN111913765A CN 111913765 A CN111913765 A CN 111913765A CN 202010827430 A CN202010827430 A CN 202010827430A CN 111913765 A CN111913765 A CN 111913765A
Authority
CN
China
Prior art keywords
data request
static variable
target data
data requests
time period
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
CN202010827430.6A
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.)
Beijing Zhongxiaoyun Iot Institute Co ltd
Original Assignee
Beijing Zhongxiaoyun Iot Institute 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 Zhongxiaoyun Iot Institute Co ltd filed Critical Beijing Zhongxiaoyun Iot Institute Co ltd
Priority to CN202010827430.6A priority Critical patent/CN111913765A/en
Publication of CN111913765A publication Critical patent/CN111913765A/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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a data request processing method. Wherein, the method comprises the following steps: screening target data requests from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; and determining whether to call the target data request or not according to the assigned static variable. The invention solves the technical problem that the existing data request processing mode has repeated and useless data requests.

Description

Data request processing method
Technical Field
The invention relates to the field of data processing, in particular to a data request processing method.
Background
Most of the existing data request modes are asynchronous requests, when the number of times of requesting the same interface in a short time is too many, the sequence of returning response data of the data requests cannot be judged, and in such a case, too many repeated and useless data requests can occur.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a data request processing method, which at least solves the technical problem that repeated and useless data requests exist in the existing data request processing mode.
According to an aspect of an embodiment of the present invention, there is provided a data request processing method, including: screening target data requests from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; and determining whether to call the target data request or not according to the assigned static variable.
Optionally, the screening out the target data request from all the data requests in the first predetermined time period includes: traversing all the data requests received within the first preset time period to obtain a traversing result; and screening target data requests with the same request interface from all the data requests according to the traversal result.
Optionally, the assigning process is performed on a static variable of the timer, and includes: and adding calling plan information into the static variable in a way of assigning the static variable, wherein the calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
Optionally, determining whether to invoke the target data request according to the assigned static variable includes: judging whether the assigned static variable is a null value or not to obtain a judgment result; if the result of the judgment is negative, setting the assigned static variable as the null value, wherein after the assigned static variable is set as the null value, the calling plan information in the assigned static variable is invalid; and if so, determining to call the target data request.
Optionally, before screening out the target data request from all data requests in the first predetermined time period, the method further includes: the timer and a static variable of the timer are created in advance.
According to another aspect of the embodiments of the present invention, there is also provided a data request processing apparatus, including: the screening module is used for screening target data requests from all data requests in a first preset time period; the assignment module is used for assigning the static variable of the timer if the target data request is detected to be a repeated data request; and the calling module is used for determining whether to call the target data request according to the assigned static variable.
Optionally, the screening module includes: the traversing unit is used for traversing all the data requests received in the first preset time period to obtain a traversing result; and the screening unit is used for screening the target data requests with the same request interfaces from all the data requests according to the traversal result.
Optionally, the assignment module includes: and adding calling plan information into the static variable in a way of assigning the static variable, wherein the calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
Optionally, the calling module includes: the judging unit is used for judging whether the assigned static variable is a null value or not to obtain a judging result; a setting unit, configured to set the assigned static variable to the null value if the determination result is negative, where after the assigned static variable is set to the null value, the call plan information in the assigned static variable is invalid; and the calling unit is used for determining to call the target data request if the judgment result is yes.
According to another aspect of the embodiments of the present invention, there is also provided a non-volatile storage medium storing a plurality of instructions, the instructions being adapted to be loaded by a processor and to execute any one of the data request processing methods.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute any one of the data request processing methods.
In the embodiment of the invention, a target data request is screened out from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; whether the target data request is called is determined according to the assigned static variable, and the purpose of avoiding repeated and useless data requests is achieved, so that the technical effect of improving the processing efficiency of the data requests is achieved, and the technical problem that repeated and useless data requests exist in the existing data request processing mode is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method of data request processing according to an embodiment of the invention;
FIG. 2 is a flow diagram of an alternative data request processing method according to an embodiment of the invention;
fig. 3 is a schematic structural diagram of a data request processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a data request processing method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that herein.
Fig. 1 is a flowchart of a data request processing method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, screening target data requests from all data requests in a first preset time period;
step S104, if the target data request is detected to be a repeated data request, assigning a static variable of a timer;
and step S106, determining whether to call the target data request or not according to the assigned static variable.
In the embodiment of the invention, a target data request is screened out from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; whether the target data request is called is determined according to the assigned static variable, and the purpose of avoiding repeated and useless data requests is achieved, so that the technical effect of improving the processing efficiency of the data requests is achieved, and the technical problem that repeated and useless data requests exist in the existing data request processing mode is solved.
The data request processing method provided by the embodiment of the application can be but is not limited to be applicable to Android systems, iOS systems and the like.
In the embodiment of the application, a plurality of target data requests with the same data interface are screened out from all data requests in a first preset time period, and if the target data requests are detected to be repeated data requests, only the last target data request is reserved to avoid repeated data calling requests, so that frequent data requests can be prevented.
In an optional embodiment, before screening out the target data request from all data requests within the first predetermined time period, the method further includes: the timer and a static variable of the timer are created in advance.
In an alternative embodiment, the step of filtering out the target data request from all data requests within the first predetermined time period comprises:
step S202, traversing all the data requests received in the first preset time period to obtain a traversing result;
and step S204, screening target data requests with the same request interface from all the data requests according to the traversal result.
As an alternative embodiment, the assigning process for the static variable of the timer includes:
step S302, adding calling plan information to the static variable by assigning a value to the static variable.
Optionally, the target data requests with the same request interface are screened out from all the data requests by traversing all the data requests received within the first predetermined time period, and if the target data requests are detected to be repeated data requests during the cycle, call plan information is added to the static variable in a manner of assigning a value to the static variable Timer.
The calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
Optionally, the first predetermined time period and the second predetermined time period may be any time period, and both may be the same or different time periods, which is not specifically limited in the embodiment of the present application.
In an alternative embodiment, fig. 2 is a flowchart of an alternative data request processing method according to an embodiment of the present invention, and as shown in fig. 2, determining whether to invoke the target data request according to assigned static variables includes:
step S402, judging whether the assigned static variable is a null value or not to obtain a judgment result;
step S404, if the result of the determination is negative, setting the assigned static variable as the null value, wherein after the assigned static variable is set as the null value, the calling plan information in the assigned static variable is invalid;
in step S406, if the determination result is yes, it is determined to invoke the target data request.
In the above optional embodiment, if the target data request needs to be called again after a second predetermined time period, determining whether the assigned static variable Timer is a null value, if the static variable Timer is not a null value, setting the assigned static variable to the null value, and after setting the assigned static variable to the null value, failing to call plan information in the assigned static variable; and if so, determining to call the target data request.
Example 2
According to an embodiment of the present invention, there is further provided an apparatus embodiment for implementing the data request processing method, and fig. 3 is a schematic structural diagram of a data request processing apparatus according to an embodiment of the present invention, as shown in fig. 3, the data request processing apparatus includes: a screening module 30, an assignment module 32, and a calling module 34, wherein:
the screening module 30 is configured to screen out a target data request from all data requests within a first predetermined time period; the assignment module 32 is configured to assign a static variable of the timer if it is detected that the target data request is a repeated data request; and the calling module 34 is used for determining whether to call the target data request according to the assigned static variable.
In an optional embodiment, the screening module includes: the traversing unit is used for traversing all the data requests received in the first preset time period to obtain a traversing result; and the screening unit is used for screening the target data requests with the same request interfaces from all the data requests according to the traversal result.
In an optional embodiment, the assignment module includes: and adding calling plan information into the static variable in a way of assigning the static variable, wherein the calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
In an optional embodiment, the invoking module includes: the judging unit is used for judging whether the assigned static variable is a null value or not to obtain a judging result; a setting unit, configured to set the assigned static variable to the null value if the determination result is negative, where after the assigned static variable is set to the null value, the call plan information in the assigned static variable is invalid; and the calling unit is used for determining to call the target data request if the judgment result is yes.
It should be noted that the above modules may be implemented by software or hardware, for example, for the latter, the following may be implemented: the modules can be located in the same processor; alternatively, the modules may be located in different processors in any combination.
It should be noted that the filtering module 30, the assigning module 32 and the calling module 34 correspond to steps S102 to S106 in embodiment 1, and the modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in embodiment 1. It should be noted that the modules described above may be implemented in a computer terminal as part of an apparatus.
It should be noted that, reference may be made to the relevant description in embodiment 1 for alternative or preferred embodiments of this embodiment, and details are not described here again.
The data request processing apparatus may further include a processor and a memory, where the screening module 30, the assigning module 32, the calling module 34, and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls a corresponding program unit from the memory, wherein one or more than one kernel can be arranged. The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
According to the embodiment of the application, the embodiment of the nonvolatile storage medium is also provided. Optionally, in this embodiment, the nonvolatile storage medium includes a stored program, and the apparatus in which the nonvolatile storage medium is located is controlled to execute any one of the data request processing methods when the program runs.
Optionally, in this embodiment, the nonvolatile storage medium may be located in any one of a group of computer terminals in a computer network, or in any one of a group of mobile terminals, and the nonvolatile storage medium includes a stored program.
Optionally, the apparatus in which the non-volatile storage medium is controlled to perform the following functions when the program is executed: screening target data requests from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; and determining whether to call the target data request or not according to the assigned static variable.
According to the embodiment of the application, the embodiment of the processor is also provided. Optionally, in this embodiment, the processor is configured to execute a program, where the program executes to execute any one of the data request processing methods.
The embodiment of the application provides an electronic device, the device comprises a processor, a memory and a program which is stored on the memory and can be run on the processor, and the processor executes the program and realizes the following steps: screening target data requests from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; and determining whether to call the target data request or not according to the assigned static variable.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: screening target data requests from all data requests in a first preset time period; if the target data request is detected to be a repeated data request, assigning a static variable of a timer; and determining whether to call the target data request or not according to the assigned static variable.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable non-volatile storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a non-volatile storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned nonvolatile storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (11)

1. A method for processing a data request, comprising:
screening target data requests from all data requests in a first preset time period;
if the target data request is detected to be a repeated data request, assigning a static variable of a timer;
and determining whether to call the target data request according to the assigned static variable.
2. The method of claim 1, wherein screening out target data requests from all data requests within a first predetermined time period comprises:
obtaining a traversal result by traversing all the data requests in the first preset time period;
and screening target data requests with the same request interface from all the data requests according to the traversal result.
3. The method of claim 1, wherein assigning the static variable of the timer comprises:
and adding calling plan information into the static variable in a mode of assigning the static variable, wherein the calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
4. The method of claim 1, wherein determining whether to invoke the target data request based on the assigned static variable comprises:
judging whether the assigned static variable is a null value or not to obtain a judgment result;
if the judgment result is negative, setting the assigned static variable as the null value, wherein after the assigned static variable is set as the null value, the calling plan information in the assigned static variable is invalid;
and if so, determining to call the target data request.
5. The method of claim 1, wherein prior to screening out a target data request from all data requests within a first predetermined time period, the method further comprises:
the timer and a static variable of the timer are created in advance.
6. A data request processing apparatus, comprising:
the screening module is used for screening target data requests from all data requests in a first preset time period;
the assignment module is used for assigning a static variable of a timer if the target data request is detected to be a repeated data request;
and the calling module is used for determining whether to call the target data request according to the assigned static variable.
7. The apparatus of claim 6, wherein the screening module comprises:
the traversing unit is used for obtaining a traversing result by traversing all the data requests in the first preset time period;
and the screening unit is used for screening target data requests with the same request interface from all the data requests according to the traversal result.
8. The apparatus of claim 6, wherein the assignment module comprises:
and adding calling plan information into the static variable in a mode of assigning the static variable, wherein the calling plan information is used for representing that the target data request is called again after waiting for a second preset time period.
9. The apparatus of claim 6, wherein the invoking module comprises:
the judging unit is used for judging whether the assigned static variable is a null value or not to obtain a judging result;
the setting unit is used for setting the assigned static variable as the null value if the judgment result is negative, wherein after the assigned static variable is set as the null value, the calling plan information in the assigned static variable is invalid;
and the calling unit is used for determining to call the target data request if the judgment result is yes.
10. A non-volatile storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to perform a data request processing method according to any one of claims 1 to 5.
11. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the data request processing method of any of claims 1 to 5.
CN202010827430.6A 2020-08-17 2020-08-17 Data request processing method Pending CN111913765A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010827430.6A CN111913765A (en) 2020-08-17 2020-08-17 Data request processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010827430.6A CN111913765A (en) 2020-08-17 2020-08-17 Data request processing method

Publications (1)

Publication Number Publication Date
CN111913765A true CN111913765A (en) 2020-11-10

Family

ID=73278186

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010827430.6A Pending CN111913765A (en) 2020-08-17 2020-08-17 Data request processing method

Country Status (1)

Country Link
CN (1) CN111913765A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104965806A (en) * 2015-06-30 2015-10-07 北京奇艺世纪科技有限公司 Request processing method and apparatus
CN106332041A (en) * 2016-08-19 2017-01-11 维沃移动通信有限公司 Data network recovery method and mobile terminal
WO2019072103A1 (en) * 2017-10-11 2019-04-18 阿里巴巴集团控股有限公司 Method and apparatus for obtaining target data
CN109857575A (en) * 2019-01-18 2019-06-07 深圳壹账通智能科技有限公司 Interface call method, device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104965806A (en) * 2015-06-30 2015-10-07 北京奇艺世纪科技有限公司 Request processing method and apparatus
CN106332041A (en) * 2016-08-19 2017-01-11 维沃移动通信有限公司 Data network recovery method and mobile terminal
WO2019072103A1 (en) * 2017-10-11 2019-04-18 阿里巴巴集团控股有限公司 Method and apparatus for obtaining target data
CN109857575A (en) * 2019-01-18 2019-06-07 深圳壹账通智能科技有限公司 Interface call method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN105335187B (en) Application processing method and device
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
CN110908865A (en) Memory leakage monitoring method and device and electronic equipment
CN109710286B (en) System upgrading method, device, equipment and storage medium
CN105721941A (en) Over-the-air upgrading control method and device of cloud television
CN109960569B (en) Virtualization processing method and device
CN106557404B (en) Application control method and mobile terminal
CN111580769A (en) Display control system, method, device, storage medium and processor
CN113285843B (en) Container network configuration method and device, computer readable medium and electronic equipment
EP3149625A1 (en) Data uniqueness control and information storage
CN108243229B (en) Request processing method and device
CN111222592A (en) Method and device for acquiring two-dimensional code of equipment
CN110222019B (en) Method and device for adjusting space occupied by file system
CN111913765A (en) Data request processing method
CN108519885B (en) Public resource loading method and device based on Flash
CN108874586B (en) Data recovery method and related product
CN111913710A (en) Method and device for setting navigation bar
CN110020268B (en) Page returning method and device
CN112187994A (en) Call limitation method, device, medium and terminal equipment
CN108829412B (en) Application updating method and device
CN108664293B (en) Application control method and device in android system
CN111324368A (en) Data sharing method and server
CN114185602B (en) Starting method, device and terminal of operating system
CN115242767B (en) Information interaction tracking method and related equipment
CN110770724A (en) Method and device for determining brushing amount resources

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