Gray release control method, medium and device

By determining the oil station version and writing it into cookies during the login stage, version confirmation errors and caching issues in grayscale release control are solved, simple and efficient control of grayscale versions is achieved, and system stability and efficiency are improved.

CN118585262APending Publication Date: 2024-09-03SHANDONG ENERGY CHAIN HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410503153.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

The existing grayscale release control method causes version confirmation errors and cache problems in the communication between the client and the server, resulting in untimely resource updates and affecting system stability.

Method used

By using the token to record the gas station information during the login phase, determine the old and new versions, and write the version information in the cookie to avoid repeated version confirmation during page requests and static resource requests, and directly retrieve the corresponding version of resources based on the cookie.

Benefits of technology

It achieves simple and efficient control of grayscale versions, reduces the cumbersome steps of version confirmation, avoids resource retrieval errors caused by version confirmation failures or errors, and improves the stability and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585262A
    Figure CN118585262A
Patent Text Reader

Abstract

The invention provides a gray release control method, a medium and equipment, and the method comprises the steps: initiating a login request to a server side, and receiving cookie which is returned by the server side and comprises version information; and initiating a static resource request to the NG or a page request to the server, and carrying the cookie comprising the version information in the static resource request or the page request, so that the NG or the server analyzes the current version information according to the cookie, and issues a static resource or a page file corresponding to the current version information. The method is simple and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer communication technology, and in particular to a grayscale release control method, medium and device. Background Art

[0002] Grayscale release (also known as canary release) is a release method that can smoothly transition between black and white. A / B testing can be performed on it, that is, some users continue to use product feature A, and some users start using product feature B. If users have no objection to B, then gradually expand the scope and migrate all users to B. Grayscale release can ensure the stability of the overall system. Problems can be discovered and adjusted during the initial grayscale to ensure their impact.

[0003] For those skilled in the art, how to efficiently control the grayscale release so that the grayscale release plan can be executed normally and efficiently is a technical issue that needs to be considered. Summary of the invention

[0004] In view of this, the present application provides a grayscale release control method, medium and electronic device, the main purpose of which is to perform efficient grayscale release.

[0005] According to one aspect of the present application, a grayscale publishing control method is provided, which is applied to a client, and the method includes:

[0006] Initiate a login request to the server and receive a cookie including version information returned by the server;

[0007] Initiate a static resource request to NG or a page request to the server, and carry the cookie including the version information in the static resource request or the page request, so that NG or the server parses the current version information according to the cookie and sends the static resource or page file corresponding to the current version information.

[0008] In one implementation, the method further includes:

[0009] Receiving a version update notification issued by the NG or the server, wherein the NG or the server compares the version information in the current cookie with that in the original cookie, and when determining that the version information has changed, issuing the version update notification;

[0010] A confirmation operation or a rejection operation is performed on the version update notification.

[0011] According to one aspect of the present application, a grayscale release control method is provided, which is applied to NG, and the method includes:

[0012] For the static resource request sent by the client, obtain the cookie including version information carried in the static resource request;

[0013] Send the static resource corresponding to the version information in the cookie to the client.

[0014] In one implementation, the method further includes:

[0015] Save the last cookie of the last static resource request, where the last cookie includes the last version information;

[0016] Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed;

[0017] If the version information changes, a version update notification is sent to the client.

[0018] According to one aspect of the present application, a grayscale release control method is provided, which is applied to a server, and the method includes:

[0019] Receiving a login request from a client for a target energy station;

[0020] In response to the login request, retrieve an old version file or resource, process the login request based on the old version file or resource, and obtain a token including target energy station information.

[0021] Parse the target energy station information according to the token, and search the pre-generated grayscale configuration list according to the target energy station information to determine the version information corresponding to the target energy station, where the version information indicates an old version or a new version;

[0022] The version information is written into a cookie and returned to the client.

[0023] In one implementation, the method further includes:

[0024] For the page request sent by the client, obtain the cookie including version information carried by the page request;

[0025] Send the page file corresponding to the version information in the cookie to the client.

[0026] In one implementation, the method further includes:

[0027] Save the last cookie of the last page request, where the last cookie includes the last version information;

[0028] Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed;

[0029] If the version information changes, a version update notification is sent to the client.

[0030] In one implementation, the method further includes:

[0031] The grayscale configuration list is generated, and the grayscale configuration list includes the correspondence between energy station information and version information, wherein a certain proportion of energy stations are selected for grayscale release according to the business area, operation information or upgrade agreement information of the target energy station.

[0032] According to one aspect of the present application, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned grayscale release control method when running.

[0033] According to one aspect of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the above-mentioned grayscale release control method.

[0034] By means of the above technical solution, the present application provides a grayscale release control method, medium and device. In the login phase, the gas station information recorded in the token is used to match the black and white list settings between the gas station versions, so as to determine whether it is a new version or an old version, and the version information is written in the cookie. Except for the login phase, when requesting pages and static resources, the corresponding version of the page or resource can be directly retrieved according to the version information in the cookie. It can be seen that the grayscale version confirmation can be performed only in the login phase, and the corresponding grayscale version resources can be directly called in other phases without repeated version confirmation, which is simple and efficient.

[0035] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0037] Figure 1 A schematic diagram of a scenario of a grayscale release control method provided in an embodiment of the present application is shown;

[0038] Figure 2 An overall logic diagram of a grayscale release control method provided by an embodiment of the present application is shown;

[0039] Figure 3 An overall interaction diagram of a grayscale publishing control method provided by an embodiment of the present application is shown;

[0040] Figure 4 The overall process diagram of a grayscale release control method provided by an embodiment of the present application is shown;

[0041] Figure 5 A flowchart of a grayscale publishing control method applied to a client provided in an embodiment of the present application is shown;

[0042] Figure 6 A flowchart of a grayscale release control method applied to NG provided in an embodiment of the present application is shown;

[0043] Figure 7 A flowchart of a grayscale publishing control method applied to a server provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0045] With the development of the Internet, many traditional industries have been integrated with the Internet to provide users with more convenient and preferential services. For example, users can use online energy trading platforms (such as APPs or mini-programs) to find nearby energy stations (gas stations, charging stations, etc.), and can also check energy prices, enjoy coupons, check and pay orders on the platform, etc., which greatly improves the user experience.

[0046] In the existing method, each time the client communicates with the server, the cookie (small text file) of the current domain is manipulated. The client does not participate in the reading and writing of cookies, and the browser automatically saves and processes them. The actual operation of cookies involves two parties: Nginx (a high-performance HTTP and reverse proxy web server, hereinafter referred to as NG) and the server. After querying the business, the server sends the grayscale mark of the cookie. When the client accesses the page and static resources, NG is responsible for reading the cookie to determine whether the js returned to the client is a new version or an old version.

[0047] The problem on the client side is that the browser will cache resources that have been visited. That is, if the browser is not refreshed next time, the same resource will show an error and the browser will directly read the last local resource. This problem will cause the service to send a new cookie to indicate that the grayscale js file needs to be read, but the old WEB page will still be opened if the opened one is cached. Therefore, some projects will give the client an instruction to refresh the new interface to avoid reading files in the browser cache. However, this method of sending instructions to the client is more cumbersome to implement and brings new overhead.

[0048] The embodiment of the present application starts from the perspective of "how to actively refresh the page based on the comparison of cookie values ​​before and after" and provides a grayscale publishing control method, which can especially reduce the tediousness of confirming version information and then retrieving corresponding files or resources on the client, and can also avoid the problem of file or resource retrieval errors caused by version confirmation failure or errors.

[0049] See also Figure 1 , showing a scenario diagram of a grayscale publishing control method provided by an embodiment of the present application. Among them, the client is a small program or APP of a user terminal, through which a target energy station server can be accessed, for example; the NG agent is a high-performance Web and reverse proxy service, which supports high-concurrency processing, and can specifically adopt a reverse proxy or forward proxy network deployment method. The NG agent supports dynamic and static separation: static requests obtain static resources locally, and dynamic requests the web server; the server is the backend server of the energy station.

[0050] See also Figure 2 , showing an overall logical schematic diagram of a grayscale release control method provided in an embodiment of the present application.

[0051] To perform business operations on a certain energy station, the client needs to log in first, and then request a page or static resource. In general, from the perspective of the backend and the frontend, the process is as follows.

[0052] 1. Server (backend) processing flow:

[0053] When the user (client) initiates a login request, the request enters the gateway in the background (server). Since it is a request for login (not logged in yet), the original old version (blue) is used and a token (including energy station information, such as energy station ID, name, geographic location, etc.) is issued. After logging in, the grayscale configuration list is searched through the energy station information to determine whether it is the old version (blue) or the new version (green), and the version information is written into the cookie and returned to the client.

[0054] The version information can be distinguished between the old version and the new version through grayscale labels: blue label and green label.

[0055] 2. Client (front-end) processing flow:

[0056] According to the cookie filled in by the gateway after login, when the front end requests static resources, a resource request carrying the cookie is sent to NG. NG determines whether it corresponds to the old version resource or the new version resource based on the version information of the cookie.

[0057] According to the cookie filled in by the gateway after login, when the front-end requests a page, a cookie containing version information is sent to the server. When passing through the back-end gateway, the version information is used to determine whether it is an old version or a new version.

[0058] Figure 3 The overall interaction diagram of a grayscale publishing control method provided by an embodiment of the present application is shown. The interactions between the client, the server, and the NG are as follows.

[0059] 1. The client initiates a service login request to the server;

[0060] 2. The server sets cookies based on the grayscale configuration, where the grayscale logo (blue or green) can indicate whether the version information is an old version or a new version;

[0061] 3. The server returns the request result to the client;

[0062] 4. The client browser automatically processes cookies;

[0063] 5. The client performs other operations to jump to the view;

[0064] 6.NG requests blue or green static JS according to the grayscale logo;

[0065] 7. The client opens the static resource and caches it.

[0066] See also Figure 4, showing an overall flow chart of a grayscale release control method provided in an embodiment of the present application.

[0067] (1) Open the app;

[0068] (2) Generate views;

[0069] (3) Request to obtain resource files;

[0070] (4) Processing requests, including: reading the last cache, reading cookies, setting cache, etc.;

[0071] (5) Compare the cookies to see if they are consistent. If they are consistent, it means that the version information has not changed, then execute (6):

[0072] Generate and display the view. If a change occurs, execute (7): mark it and initiate a notification layer, which will remain in place for a long time, that is, send a notification to the client, such as "A new version has been found. Do you want to upgrade to the new version immediately?"

[0073] (6) In response to the operation confirmation (the user confirms the operation of upgrading to the new version), refresh the interface and restart.

[0074] See also Figure 5 A flowchart of a grayscale publishing control method applied to a client provided in an embodiment of the present application is shown, including:

[0075] S501: Initiate a login request to the server, and receive a cookie including version information returned by the server;

[0076] S502: Initiate a static resource request to NG or a page request to the server, and carry a cookie including version information in the static resource request or page request, so that NG or the server parses the current version information according to the cookie and sends the static resource or page file corresponding to the current version information.

[0077] In one implementation, the method further includes:

[0078] 1) Receive the version update notification issued by NG or the server, where NG or the server compares the version information in the current cookie with the original cookie, and issues a version update notification when it is determined that the version information has changed;

[0079] 2) Confirm or reject the version update notification.

[0080] See also Figure 6 , shows a flowchart of a grayscale release control method applied to NG provided in an embodiment of the present application, including:

[0081] S601: acquiring a cookie including version information carried in a static resource request sent by a client;

[0082] S602: Send the static resource corresponding to the version information in the cookie to the client.

[0083] In one implementation, the method further includes:

[0084] 1) Save the last cookie of the last static resource request, where the last cookie includes the last version information;

[0085] 2) Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed;

[0086] 3) If the version information changes, send a version update notification to the client.

[0087] See also Figure 7 , shows a flow chart of a grayscale publishing control method applied to a server provided in an embodiment of the present application, including:

[0088] S701: receiving a login request from a client for a target energy station;

[0089] S702: Retrieving an old version file or resource for the login request, processing the login request based on the old version file or resource, and obtaining a token including target energy station information;

[0090] S703: parse the target energy station information according to the token, and search the pre-generated grayscale configuration list according to the target energy station information to determine the version information corresponding to the target energy station, where the version information indicates an old version or a new version;

[0091] S704: Write the version information into a cookie and return it to the client.

[0092] In one implementation, the method further includes:

[0093] 1) For the page request sent by the client, obtain the cookie including version information carried by the page request;

[0094] 2) Send the page file corresponding to the version information in the cookie to the client.

[0095] In one implementation, the method further includes:

[0096] a) Save the last cookie of the last page request, where the last cookie includes the last version information;

[0097] b) Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed;

[0098] c) If the version information changes, send a version update notification to the client.

[0099] In one implementation, a grayscale configuration list is generated in advance, wherein the grayscale configuration list includes the correspondence between energy station information and version information, wherein a certain proportion of energy stations can be selected for grayscale release according to the business area, operation information or upgrade agreement information of the target energy station. The grayscale configuration list may include a grayscale whitelist and a grayscale blacklist, wherein the grayscale whitelist includes energy stations that are determined to be grayscale released, and the grayscale blacklist includes energy stations that are determined not to be grayscale released. For energy stations that are not on the whitelist or blacklist, they can be flexibly set in the whitelist or blacklist.

[0100] Therefore, through the grayscale release control method of the embodiment of the present application, in the login stage, the gas station information recorded in the token is used to match the black and white list settings between the gas station versions, so as to determine whether it is a new version or an old version, and the version information is written in the cookie. Except for the login stage, when requesting pages and static resources, the corresponding version of the page or resource can be directly retrieved according to the version information in the cookie. It can be seen that the grayscale version confirmation can be performed only in the login stage, and the corresponding grayscale version resources can be directly called in other stages without repeated version confirmation, which is simple and efficient.

[0101] An embodiment of the present application further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0102] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0103] Initiate a login request to the server and receive a cookie including version information returned by the server;

[0104] Initiate a static resource request to NG or a page request to the server, and carry the cookie including the version information in the static resource request or the page request, so that NG or the server parses the current version information according to the cookie and sends the static resource or page file corresponding to the current version information;

[0105] or,

[0106] For the static resource request sent by the client, obtain the cookie including version information carried in the static resource request;

[0107] Send the static resource corresponding to the version information in the cookie to the client;

[0108] or,

[0109] Receiving a login request from a client for a target energy station;

[0110] In response to the login request, retrieve an old version file or resource, process the login request based on the old version file or resource, and obtain a token including target energy station information.

[0111] Parse the target energy station information according to the token, and search the pre-generated grayscale configuration list according to the target energy station information to determine the version information corresponding to the target energy station, where the version information indicates an old version or a new version;

[0112] The version information is written into a cookie and returned to the client.

[0113] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0114] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0115] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0116] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0117] Initiate a login request to the server and receive a cookie including version information returned by the server;

[0118] Initiate a static resource request to NG or a page request to the server, and carry the cookie including the version information in the static resource request or the page request, so that NG or the server parses the current version information according to the cookie and sends the static resource or page file corresponding to the current version information;

[0119] or,

[0120] For the static resource request sent by the client, obtain the cookie including version information carried in the static resource request;

[0121] Send the static resource corresponding to the version information in the cookie to the client;

[0122] or,

[0123] Receiving a login request from a client for a target energy station;

[0124] In response to the login request, retrieve an old version file or resource, process the login request based on the old version file or resource, and obtain a token including target energy station information.

[0125] Parse the target energy station information according to the token, and search the pre-generated grayscale configuration list according to the target energy station information to determine the version information corresponding to the target energy station, where the version information indicates an old version or a new version;

[0126] The version information is written into a cookie and returned to the client.

[0127] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0128] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0129] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0134] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A grayscale release control method, characterized in that: Applied to a client, the method comprises: Initiate a login request to the server and receive a cookie including version information returned by the server; Initiate a static resource request to NG or a page request to the server, and carry the cookie including the version information in the static resource request or the page request, so that NG or the server parses the current version information according to the cookie and sends the static resource or page file corresponding to the current version information.

2. The method according to claim 1, characterized in that Also includes: Receiving a version update notification issued by the NG or the server, wherein the NG or the server compares the version information in the current cookie with that in the original cookie, and when determining that the version information has changed, issuing the version update notification; A confirmation operation or a rejection operation is performed on the version update notification.

3. A grayscale release control method, characterized in that: Applied to NG, the method comprises: For the static resource request sent by the client, obtain the cookie including version information carried in the static resource request; Send the static resource corresponding to the version information in the cookie to the client.

4. The method according to claim 3, characterized in that The method further comprises: Save the last cookie of the last static resource request, where the last cookie includes the last version information; Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed; If the version information changes, a version update notification is sent to the client.

5. A grayscale release control method, characterized in that: Applied to the server, the method includes: Receiving a login request from a client for a target energy station; In response to the login request, retrieve an old version file or resource, process the login request based on the old version file or resource, and obtain a token including target energy station information. Parse the target energy station information according to the token, and search the pre-generated grayscale configuration list according to the target energy station information to determine the version information corresponding to the target energy station, where the version information indicates an old version or a new version; The version information is written into a cookie and returned to the client.

6. The method according to claim 5, characterized in that The method further comprises: For the page request sent by the client, obtain the cookie including version information carried by the page request; Send the page file corresponding to the version information in the cookie to the client.

7. The method according to claim 6, characterized in that The method further comprises: Save the last cookie of the last page request, where the last cookie includes the last version information; Compare the version information in the current cookie with the version information in the previous cookie to determine whether the version information has changed; If the version information changes, a version update notification is sent to the client.

8. The method according to claim 5, 6 or 7, characterized in that: Also includes: The grayscale configuration list is generated, and the grayscale configuration list includes the correspondence between energy station information and version information, wherein a certain proportion of energy stations are selected for grayscale release according to the business area, operation information or upgrade agreement information of the target energy station.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 8 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.