CN113296860B - Progress bar refreshing method and device, computer equipment and readable storage medium - Google Patents

Progress bar refreshing method and device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN113296860B
CN113296860B CN202110521474.0A CN202110521474A CN113296860B CN 113296860 B CN113296860 B CN 113296860B CN 202110521474 A CN202110521474 A CN 202110521474A CN 113296860 B CN113296860 B CN 113296860B
Authority
CN
China
Prior art keywords
refreshing
progress bar
file
uploading
speed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110521474.0A
Other languages
Chinese (zh)
Other versions
CN113296860A (en
Inventor
王怀
庄之中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare 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 Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202110521474.0A priority Critical patent/CN113296860B/en
Publication of CN113296860A publication Critical patent/CN113296860A/en
Application granted granted Critical
Publication of CN113296860B publication Critical patent/CN113296860B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0002Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for refreshing a progress bar, a computer device, and a readable storage medium. The method comprises the following steps: acquiring the size of a file to be uploaded; determining the refreshing speed of the uploading progress bar, wherein the refreshing speed is determined based on the size of the file and the network speed of the uploading network; determining the refreshing times of the uploading progress bar, wherein the refreshing times are determined according to the refreshing speed, the file size and the network speed; and refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar. By adopting the method, the uploading information does not need to be acquired in real time and the uploading progress is displayed.

Description

Progress bar refreshing method and device, computer equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for refreshing a progress bar, a computer device, and a readable storage medium.
Background
In response to the rapid development of internet technology, various websites are continuously appeared, progress bars are used as the most common and most popular Web page elements are basically visible everywhere.
In a traditional mode, a real-time progress bar during file uploading or file downloading is that after a user clicks a button for confirming uploading, a background returns the size of an uploaded or downloaded file and the number of the remaining files without uploading or downloading in real time, so that the progress bar can be conveniently rendered at the front end through data calculation after the data are taken by the front end.
However, when the front-end component cannot acquire the uploaded information in real time, such as the updoad component of ant, the above method is not applicable. Therefore, it is an urgent need to solve the problem at the present stage to provide a method capable of displaying the uploading progress without acquiring the uploading information in real time.
Disclosure of Invention
In view of the foregoing, there is a need to provide a method, an apparatus, a computer device, and a readable storage medium for refreshing a progress bar without acquiring upload information in real time and displaying an upload progress.
A method of progress bar refresh, the method comprising:
acquiring the size of a file to be uploaded;
determining the refreshing speed of the uploading progress bar, wherein the refreshing speed is determined based on the size of the file and the network speed of the uploading network;
determining the refreshing times of the uploading progress bar, wherein the refreshing times are determined according to the refreshing speed, the file size and the network speed;
And refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
In one embodiment, determining the refresh number of the upload progress bar includes:
determining the total uploading duration of the file to be uploaded according to the network speed and the file size;
and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
In one embodiment, the updating the upload progress bar according to the number of times of updating and a preset total step length of the upload progress bar includes:
determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar;
and refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
In one embodiment, determining the refresh rate of the upload progress bar comprises:
judging whether the file size of the file to be uploaded is smaller than or equal to a preset threshold value or not;
when the file size is determined to be smaller than or equal to a preset threshold value, acquiring the average network speed of an uploading network and the fixed refreshing speed of an uploading progress bar;
determining the refreshing times of the uploading progress bar, comprising the following steps:
and determining the refreshing times of the uploading progress bar according to the fixed refreshing speed, the file size and the average network speed.
In one embodiment, after determining whether the size of the file to be uploaded is smaller than or equal to a preset threshold, the method further includes:
when the file size is determined to be larger than a preset threshold value, acquiring the real-time network speed of an uploading network;
determining the real-time refreshing speed of the unit step length of the uploading progress bar according to the size of the file and the real-time network speed;
and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after the updating the upload progress bar according to the real-time updating speed, the method further includes:
acquiring the size of the residual file of the file to be uploaded;
judging whether the size of the residual file is larger than a preset threshold value or not;
and when the size of the residual file is larger than the preset threshold value, continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the size of the file and the real-time network speed, and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after determining whether the remaining file size is larger than the preset threshold, the method further includes:
when the size of the residual file is determined to be smaller than or equal to the preset threshold value, determining the residual refreshing times of the uploading progress bar based on the fixed refreshing speed, the size of the residual file and the average network speed;
Acquiring the remaining step length of the uploading progress bar;
and refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
A progress bar refreshing apparatus, the apparatus comprising:
the file size acquisition module is used for acquiring the size of a file to be uploaded;
the updating speed determining module is used for determining the updating speed of the uploading progress bar, and the updating speed is determined based on the size of the file and the network speed of the uploading network;
the updating time determining module is used for determining the updating time of the uploading progress bar, and the updating speed is determined according to the updating speed and the network speed of the uploading network;
and the refreshing module is used for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of any of the above embodiments when the processor executes the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any of the above embodiments.
According to the progress bar refreshing method, the progress bar refreshing device, the computer equipment and the readable storage medium, the refreshing speed of the uploading progress bar is determined by obtaining the file size of the file to be uploaded, the refreshing speed is determined based on the file size and the network speed of the uploading network, then the refreshing time of the uploading progress bar is determined, the refreshing time is determined according to the refreshing speed, the file size and the network speed, and the uploading progress bar is refreshed further according to the refreshing time and the preset total step length of the uploading progress bar. Therefore, in some scenes that the uploading information cannot be acquired in real time, the refreshing speed and the refreshing times of the uploading progress can be estimated according to the size of the file and the network speed of the uploading network, refreshing display of the uploading progress bar is carried out based on the total step length of the uploading progress bar, the problem that the uploading progress cannot be refreshed and displayed when the front end assembly cannot acquire the uploading information in real time is solved, the uploading progress of uploading the file can be simulated, and user experience is improved.
Drawings
FIG. 1 is a diagram of an application scenario of a progress bar refresh method in an embodiment;
FIG. 2 is a flow diagram illustrating a method for refreshing a progress bar in one embodiment;
FIG. 3 is a flow chart illustrating a method for refreshing a progress bar according to another embodiment;
FIG. 4 is a block diagram of a progress bar refresh apparatus in one embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The progress bar refreshing method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. Specifically, the user triggers generation of an upload instruction through the terminal 102 to trigger uploading of the file data, for example, the user may click an upload button on a terminal interface through a mouse to trigger uploading of the file. After receiving the upload instruction, the server 104 may obtain the file size of the file to be uploaded based on the upload instruction, and determine the refresh rate of the upload progress bar, where the refresh rate is determined based on the file size and the network speed of the upload network. Server 104 may then determine a refresh rate of the upload progress bar, the refresh rate being determined based on the refresh rate, the file size, and the network speed. Further, the server 104 may refresh the upload progress bar according to the refresh times and a preset total step length of the upload progress bar. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a progress bar refreshing method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
step S202, the file size of the file to be uploaded is obtained.
The file to be uploaded is file data which is to be uploaded to a cloud system or a remote system, and the file size of the file to be uploaded can be represented as S.
In this embodiment, the file to be uploaded may include specific file content and related file information, such as file name, file size, file storage location, uploading destination, and other data.
In this embodiment, after preparing to complete a file to be uploaded, a user may generate an upload instruction through an operation on a terminal interface, and trigger a server to upload the file to be uploaded.
Specifically, the user can generate an upload instruction by triggering an upload control or an upload button displayed on the terminal interface, and send the upload instruction to the server.
In this embodiment, after acquiring the upload instruction, the server may acquire the file to be uploaded from the data storage location according to the upload instruction, and execute an upload operation of the file.
In this embodiment, the file to be uploaded may be a single file, or may be multiple files including two files, which is not limited in this application.
In this embodiment, when the file to be uploaded is a file corresponding to more than two files, the server may obtain the files from the storage locations of the files respectively according to the uploading instruction, and then perform the corresponding operation.
Step S204, determining the refreshing speed of the uploading progress bar, wherein the refreshing speed is determined based on the size of the file and the network speed of the uploading network.
The refresh rate refers to a rate at which the upload progress bar is refreshed on the terminal or the front-end interface, and may be represented as, for example, one refresh in 1 minute, one refresh in 5 seconds, or the like.
In this embodiment, the network speed refers to a speed of uploading a network, which may be denoted as F, may be an average network speed within a certain time period, or may refer to a real-time network speed, which may be determined specifically according to an actual application scenario, and this is not limited in this application.
In this embodiment, after acquiring the file to be uploaded, the server may determine the refresh rate of the upload progress bar according to the size of the acquired file and the network speed of the upload network. For example, the larger the file, the slower the network speed, the less frequent the refresh, the smaller the file, the faster the network speed, the more frequent the refresh, etc.
As described above, the file to be uploaded may be a combination of two or more files. In this embodiment, when the file to be uploaded is a combination of more than two files, the upload progress bar may be upload progress bars corresponding to the files, respectively, such as the progress bar 1 corresponding to the file 1 and the progress bar 2 corresponding to the file 2, or may also correspond to the upload progress bar of the whole file data, that is, the progress bar corresponds to the file 1 and the file 2 at the same time, and the progress bar indicates the total upload progress of the file 1 and the file 2.
And step S206, determining the refreshing times of the uploading progress bar, wherein the refreshing times are determined according to the refreshing speed, the file size and the network speed.
The refresh number refers to the refresh number of the progress bar in the whole uploading process of the file to be uploaded, and may be represented as N.
In this embodiment, after determining the refresh rate, the file size, and the network speed, the server may calculate the refresh number N of the upload progress bar.
Specifically, the refresh rate, the file size, and the network speed and the refresh rate may all be a positive correlation or a negative correlation, for example, the faster the network speed is, the fewer the refresh times may be, the slower the refresh rate is, the more the refresh times may be, and the like.
And S208, refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
The total step length of the upload progress bar refers to the number of the total progress length of the upload progress bar divided into unit step lengths, for example, if the upload progress bar is divided into 100 parts, the total step length of the upload progress bar is 100. The total step size may be denoted as K.
In this embodiment, the server may preset a total step size of the upload progress bar, which may be, for example, 100 or 1000, and specifically may determine the total step size according to the precision of the corresponding progress bar, for example, if the precision requirement is higher, a larger total step size may be set, such as 1000, and the precision requirement is lower, and a smaller total step size may be set, such as 100.
It will be understood by those skilled in the art that the present invention is only exemplary, and in other embodiments, the total step size may be in other numerical ranges, and the present invention is not limited thereto. And references herein to "larger", "smaller", "higher" and "lower" are relative.
In this embodiment, the server may query and obtain the total step length K corresponding to the precision requirement from the configuration table according to the precision requirement of the progress bar, and refresh the upload progress bar according to the refresh number N and the total step length K. For example, the forward step size for a single refresh may be calculated and then the refresh presentation may be performed.
According to the progress bar refreshing method, the file size of a file to be uploaded is obtained, the refreshing speed of the uploading progress bar is determined, the refreshing speed is determined based on the file size and the network speed of an uploading network, then the refreshing times of the uploading progress bar are determined, the refreshing times are determined according to the refreshing speed, the file size and the network speed, and the uploading progress bar is refreshed further according to the refreshing times and the preset total step length of the uploading progress bar. Therefore, in some scenes that the uploading information cannot be acquired in real time, the refreshing speed and the refreshing times of the uploading progress can be estimated according to the size of the file and the network speed of the uploading network, refreshing display of the uploading progress bar is carried out based on the total step length of the uploading progress bar, the problem that the uploading progress cannot be refreshed and displayed when the front end assembly cannot acquire the uploading information in real time is solved, the uploading progress of uploading the file can be simulated, and user experience is improved.
In one embodiment, determining the refresh number of the upload progress bar may include: determining the total uploading duration of the file to be uploaded according to the network speed and the file size; and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
The total uploading duration refers to time consumed for uploading the file to be uploaded to the target position, and may be represented as T, where the larger the file size of the file to be uploaded is, the longer the consumed time is, and vice versa. Similarly, for the same file to be uploaded, the faster the network speed is, the faster the uploading is, the shorter the time required to be consumed is, and the slower the network speed is, the slower the uploading is, the longer the time required to be consumed is.
In this embodiment, the server may determine the total time T consumed for uploading the file to be uploaded according to the file size S of the file to be uploaded and the network speed F of the uploading network.
Further, the server may determine the refresh number N of times for refreshing the upload progress bar according to the total duration T and the refresh rate.
For example, if the file size S is 20MB, the network speed F is 1MB/S, and the obtained refresh rate is 2 seconds for one refresh, the total upload time T can be obtained as 20S, and then the refresh number N is determined as 10 times according to the total upload time T and the refresh rate.
In one embodiment, the refreshing the upload progress bar according to the number of times of refreshing and a preset total step length of the upload progress bar may include: determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar; and refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
The single refresh step length may also be referred to as a forward step length, which refers to a forward step length of the upload progress bar when the server performs refresh every time, and may be represented as step.
In this embodiment, the server may determine a single refresh step according to the refresh time N and a preset total step K of the upload progress bar, and continue to refer to the previous example, where the refresh time N is 10 times, and the total step K is 100, the server may determine that the single refresh step is 100/10 ═ 10, and when the single refresh is performed, the forward step of the upload progress bar or the single refresh step is 10.
Further, the server may refresh the upload progress bar at a refresh rate based on a single refresh step length, that is, the server may refresh the progress bar at a frequency of once refresh for 2 seconds by 10 step lengths every time, and when the progress bar is refreshed to 10 th time, the progress bar is refreshed to 100, indicating that the uploading of the file to be uploaded is completed.
In one embodiment, determining the refresh rate of the upload progress bar may include: judging whether the file size of the file to be uploaded is smaller than or equal to a preset threshold value or not; and when the file size is determined to be smaller than or equal to the preset threshold value, acquiring the average network speed of the uploading network and the fixed refreshing speed of the uploading progress bar.
Specifically, referring to fig. 3, after the server acquires the file to be uploaded, the server may determine the file to be uploaded based on a preset threshold, and determine whether the size of the file to be uploaded is smaller than or equal to the preset threshold.
In this embodiment, the determination of the preset threshold may be determined based on a specific service requirement, and may be, for example, 20MB, 50MB, or 100 MB.
In this embodiment, when the server determines that the size of the file is smaller than or equal to the preset threshold, the server may determine that the data volume of the file to be uploaded is smaller, and the server may determine that the refresh rate of the upload progress bar is a fixed refresh rate, for example, one refresh per 2 seconds, and obtain an average network speed of the upload network, that is, a fixed network speed, and perform subsequent processing.
In this embodiment, the server may determine an average network speed of the upload network based on the historical network speed. Specifically, the average network speed corresponding to the uploading network may be determined by the network speed in the historical time interval, or the average network speed of the uploading network may be determined by a deep learning-based method, for example, the average network speed of the uploading network in a certain time interval may be estimated by a trained network model.
In this embodiment, determining the number of times of refreshing the upload progress bar may include: and determining the refreshing times of the uploading progress bar according to the fixed refreshing speed, the file size and the average network speed.
In this embodiment, after determining that the file size of the file to be uploaded is less than or equal to the preset threshold, the server may determine the refresh time N of the upload progress bar according to the obtained fixed refresh rate1 and the average network speed F1, that is, in the manner described above, according to the file size S of the file to be uploaded and the average network speed F1, determine the total upload time T of the file to be uploaded, and then determine the corresponding refresh time N according to the total upload time T and the fixed refresh rate 1.
In the embodiment, by judging the file size of the file to be uploaded, and acquiring a fixed refreshing speed and a fixed average network speed when the file size is determined to be smaller than or equal to the preset threshold value, and then calculating the refreshing times, the refreshing times and the refreshing display of the progress bar can be performed on the file with small data volume in a simpler manner, and the real-time network speed and the file uploading condition do not need to be acquired, so that the consumption of server resources can be reduced, and the processing efficiency and the processing speed are improved.
In one embodiment, after determining whether the size of the file to be uploaded is smaller than or equal to the preset threshold, the method may further include: when the file size is determined to be larger than a preset threshold value, acquiring the real-time network speed of an uploading network; determining the real-time refreshing speed of the unit step length of the uploading progress bar according to the size of the file and the real-time network speed; and refreshing the uploading progress bar according to the real-time refreshing speed.
In this embodiment, when the server determines that the file size of the file to be uploaded is greater than a preset threshold, for example, greater than 20MB, the server may obtain a real-time network speed of the uploading network through the network interface, which is denoted as F2, and determine a real-time refresh rate2 of a refresh unit step of the uploading progress bar based on the obtained real-time network speed F2 and the file size S of the file to be uploaded.
The unit step size refers to the smallest unit of measure of the total step size, for example, as described above, the total step size is 100, and the unit step size may be 1.
In this embodiment, the server may determine an upload duration T1 of the file to be uploaded according to the file size S and the real-time network speed F2, and then determine a real-time refresh rate2 of a refresh unit step of the upload progress bar according to the upload duration T1 and the total step K of the upload progress bar.
Further, the server may refresh the upload progress bar in real time according to the determined real-time refresh rate2, that is, each time the upload progress bar is refreshed, the upload progress bar advances by a unit step length.
In this embodiment, the real-time network speed changes in real time, and the file to be uploaded changes gradually with the change of the uploading time, so that the obtained uploading duration changes in real time for each moment. Therefore, the real-time refreshing speed of the refreshing unit step length of the uploading progress bar determined based on the uploading duration is also changed in real time, so that the refreshing of the progress bar is matched with the uploading progress of the file to be uploaded more, the refreshing and displaying accuracy of the uploading progress bar can be improved, and the display effect can be improved.
In one embodiment, after the updating the upload progress bar according to the real-time updating speed, the method may further include: acquiring the size of the rest files of the files to be uploaded; judging whether the size of the residual file is larger than a preset threshold value or not; and when the size of the residual file is larger than the preset threshold value, continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the size of the file and the real-time network speed, and refreshing the uploading progress bar according to the real-time refreshing speed.
In this embodiment, the server may estimate the remaining file size of the file to be uploaded at each time S1, i.e., the data amount of the remaining file, according to the real-time network speed F2.
In this embodiment, the server may compare the acquired remaining file size S1 with a preset threshold, and determine whether the acquired remaining file size S1 is greater than the preset threshold, for example, whether the acquired remaining file size S1 is greater than the aforementioned 20 MB.
In this embodiment, when the server determines that the size S1 of the remaining file is greater than the preset threshold, the server may determine that the data amount of the remaining file of the file to be uploaded is still relatively large, determine to continue to determine the real-time refresh rate of the refresh unit step length of the upload progress bar according to the size of the file and the real-time network speed, and refresh the upload progress bar according to the real-time refresh rate.
In one embodiment, after determining whether the remaining file size is larger than the preset threshold, the method may further include: when the size of the residual file is determined to be smaller than or equal to the preset threshold value, determining the residual refreshing times of the uploading progress bar based on the fixed refreshing speed, the size of the residual file and the average network speed; obtaining the remaining step length of the uploading progress bar; and refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
In this embodiment, when the server determines that the size S1 of the remaining file of the file to be uploaded is smaller than or equal to the preset threshold, for example, smaller than or equal to 20MB, at this time, the server may determine that the data amount of the remaining file of the file to be uploaded is already small, and then the server may obtain the fixed refresh rate1 and the average network speed F3 of the uploading network according to the foregoing manner, calculate the remaining refresh number N1, and refresh and display the progress bar.
Specifically, when the server determines that the size S1 of the remaining file is smaller than or equal to the preset threshold, the server may determine that the refresh rate of the corresponding upload progress bar is a fixed refresh rate1 and remains unchanged, and then obtain the average network speed F3 of the upload network. At this time, the average network speed F3 acquired by the server may be the average network speed of the preset time period before the current time or may also be the aforementioned F1.
Further, the server may determine the remaining upload time T2 of the file to be uploaded based on the remaining file size S1 and the average network speed F3, and then determine the remaining refresh number N1 according to the remaining upload time T2 and the fixed refresh rate 1.
Further, the server may determine the refreshed step K1 of the upload progress bar according to the number of times of refreshing N2. Since the refresh is performed in unit steps at the time of the real-time refresh, the refreshed step K1 may be equal in number to the number of times N2 that the refresh has been performed.
Further, the server may determine the remaining step size K2 — K-K1 from the total step size K and the refreshed step size K1.
In this embodiment, the server may refresh the upload progress bar according to the remaining step K2 and the remaining refresh number N1. For example, the step1 of advancing for each of the remaining refreshes is determined to be K2/N1 according to the remaining refresh number N1 and the remaining step K2. Then, according to a fixed refresh rate1, in each refresh, the uploading progress bar is refreshed according to a forward step1 until the progress bar is refreshed, and the uploading of the file to be uploaded is indicated to be completed.
It should be understood that although the steps in the flowcharts of fig. 2 and 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 4, there is provided a progress bar refreshing apparatus including: a file size obtaining module 100, a refresh rate determining module 200, a refresh number determining module 300, and a refresh module 400, wherein:
the file size obtaining module 100 is configured to obtain a file size of a file to be uploaded.
And a refresh rate determining module 200, configured to determine a refresh rate of the upload progress bar, where the refresh rate is determined based on the file size and a network rate of the upload network.
The refresh number determining module 300 is configured to determine the refresh number of the upload progress bar, where the refresh rate is determined according to the refresh rate and the network rate of the upload network.
The refreshing module 400 is configured to refresh the upload progress bar according to the refresh times and a preset total step length of the upload progress bar.
In one embodiment, the refresh number determination module 300 may include:
and the total uploading time length determining submodule is used for determining the total uploading time length of the files to be uploaded according to the network speed and the file size.
And the refreshing time determining submodule is used for determining the refreshing time of the uploading progress bar according to the total uploading time and the refreshing speed.
In one embodiment, the refresh module 400 may include:
And the single refreshing step length determining submodule is used for determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
And the refreshing submodule is used for refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
In one embodiment, the refresh rate determining module 200 may include:
and the judging submodule is used for judging whether the size of the file to be uploaded is smaller than or equal to a preset threshold value.
And the obtaining submodule is used for obtaining the average network speed of the uploading network and the fixed refreshing speed of the uploading progress bar when the file size is determined to be smaller than or equal to the preset threshold value.
In this embodiment, the refresh-number determining module 300 is configured to determine the refresh number of the upload progress bar according to a fixed refresh rate, a file size, and an average network speed.
In one embodiment, the apparatus may further include:
and the real-time network speed acquisition module is used for acquiring the real-time network speed of the uploading network when the size of the file is determined to be larger than the preset threshold value after judging whether the size of the file to be uploaded is smaller than or equal to the preset threshold value.
And the real-time refreshing speed determining module is used for determining the real-time refreshing speed of the unit step length of the uploading progress bar refreshing according to the file size and the real-time network speed.
And the real-time refreshing module is used for refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, the apparatus may further include:
and the residual file size acquisition module is used for acquiring the residual file size of the file to be uploaded after the uploading progress bar is refreshed according to the real-time refreshing speed.
And the threshold judging module is used for judging whether the size of the residual file is larger than a preset threshold.
And the continuous execution module is used for continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the file size and the real-time network speed when the size of the residual file is determined to be larger than the preset threshold value, and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, the apparatus may further include:
and the residual refreshing time determining module is used for determining the residual refreshing time of the uploading progress bar based on the fixed refreshing speed, the residual file size and the average network speed when the residual file size is determined to be smaller than or equal to the preset threshold value after judging whether the residual file size is larger than the preset threshold value.
The residual step length determining module is used for obtaining the residual step length of the uploading progress bar;
and the continuous refreshing module is used for refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
For the specific definition of the progress bar refreshing device, reference may be made to the above definition of the progress bar refreshing method, which is not described herein again. The modules in the progress bar refreshing apparatus can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data such as file data, network speed, refreshing times, total step length and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a progress bar refresh method.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: acquiring the size of a file to be uploaded; determining the refreshing speed of the uploading progress bar, wherein the refreshing speed is determined based on the size of the file and the network speed of the uploading network; determining the refreshing times of the uploading progress bar, wherein the refreshing times are determined according to the refreshing speed, the file size and the network speed; and refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
In one embodiment, the processor, when executing the computer program, determines the number of refreshes of the upload progress bar, and may include: determining the total uploading duration of the file to be uploaded according to the network speed and the file size; and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
In one embodiment, when executing the computer program, the processor implements refreshing the upload progress bar according to the number of times of refreshing and a preset total step size of the upload progress bar, and may include: determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar; and refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
In one embodiment, the processor, when executing the computer program, determines a refresh rate of the upload progress bar, and may include: judging whether the file size of the file to be uploaded is smaller than or equal to a preset threshold value or not; and when the file size is determined to be smaller than or equal to the preset threshold value, acquiring the average network speed of the uploading network and the fixed refreshing speed of the uploading progress bar.
In this embodiment, the determining the refresh number of the upload progress bar by the processor when executing the computer program may include: and determining the refreshing times of the uploading progress bar according to the fixed refreshing speed, the file size and the average network speed.
In one embodiment, after the processor determines whether the size of the file to be uploaded is smaller than or equal to a preset threshold when executing the computer program, the processor may further perform the following steps: when the file size is determined to be larger than a preset threshold value, acquiring the real-time network speed of an uploading network; determining the real-time refreshing speed of the unit step length of the uploading progress bar according to the size of the file and the real-time network speed; and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after the processor refreshes the upload progress bar at a real-time refresh rate when executing the computer program, the following steps may be further implemented: acquiring the size of the residual file of the file to be uploaded; judging whether the size of the residual file is larger than a preset threshold value or not; and when the size of the residual file is larger than the preset threshold value, continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the size of the file and the real-time network speed, and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after the processor determines whether the size of the remaining file is larger than the preset threshold when executing the computer program, the following steps may be further implemented: when the size of the residual file is determined to be smaller than or equal to the preset threshold value, determining the residual refreshing times of the uploading progress bar based on the fixed refreshing speed, the size of the residual file and the average network speed; obtaining the remaining step length of the uploading progress bar; and refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring the size of a file to be uploaded; determining the refreshing speed of the uploading progress bar, wherein the refreshing speed is determined based on the size of the file and the network speed of the uploading network; determining the refreshing times of the uploading progress bar, wherein the refreshing times are determined according to the refreshing speed, the file size and the network speed; and refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar.
In one embodiment, the computer program when executed by the processor for performing determining a number of refreshes of the upload progress bar may include: determining the total uploading duration of the files to be uploaded according to the network speed and the file size; and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
In one embodiment, when executed by the processor, the computer program implements refreshing the upload progress bar according to the refresh times and a preset total step size of the upload progress bar, and may include: determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and the preset total step length of the uploading progress bar; and refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
In one embodiment, the computer program when executed by the processor for determining a refresh rate of the upload progress bar may include: judging whether the file size of the file to be uploaded is smaller than or equal to a preset threshold value or not; and when the file size is determined to be smaller than or equal to the preset threshold value, acquiring the average network speed of the uploading network and the fixed refreshing speed of the uploading progress bar.
In this embodiment, the determining the refresh number of the upload progress bar when the computer program is executed by the processor may include: and determining the refreshing times of the uploading progress bar according to the fixed refreshing speed, the file size and the average network speed.
In one embodiment, after the computer program is executed by the processor to determine whether the file size of the file to be uploaded is smaller than or equal to a preset threshold, the following steps may be further implemented: when the file size is determined to be larger than a preset threshold value, acquiring the real-time network speed of an uploading network; determining the real-time refreshing speed of the unit step length of the uploading progress bar according to the size of the file and the real-time network speed; and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after the computer program is executed by the processor to refresh the upload progress bar according to the real-time refresh rate, the following steps may be further implemented: acquiring the size of the residual file of the file to be uploaded; judging whether the size of the residual file is larger than a preset threshold value or not; and when the size of the residual file is larger than the preset threshold value, continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the size of the file and the real-time network speed, and refreshing the uploading progress bar according to the real-time refreshing speed.
In one embodiment, after the computer program is executed by the processor to determine whether the size of the remaining file is larger than the preset threshold, the following steps may be further implemented: when the size of the residual file is determined to be smaller than or equal to the preset threshold value, determining the residual refreshing times of the uploading progress bar based on the fixed refreshing speed, the size of the residual file and the average network speed; obtaining the remaining step length of the uploading progress bar; and refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (8)

1. A progress bar refreshing method, comprising:
acquiring the size of a file to be uploaded;
displaying an uploading progress bar;
judging whether the size of the file to be uploaded is smaller than or equal to a preset threshold value or not;
when the file size is determined to be smaller than or equal to the preset threshold, acquiring the average network speed of an uploading network and the refreshing speed of the uploading progress bar, wherein the refreshing speed is the interval duration of the uploading progress bar for refreshing once;
Determining the refreshing times of the uploading progress bar according to the refreshing speed, the file size and the average network speed;
refreshing the uploading progress bar according to the refreshing times and a preset total step length of the uploading progress bar, wherein the total step length is the number of unit step lengths which are decomposed from the total progress length of the uploading progress bar;
when the file size is larger than the preset threshold value, acquiring the real-time network speed of the uploading network;
determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the file size, the total step length of the uploading progress bar and the real-time network speed;
refreshing the uploading progress bar according to the real-time refreshing speed;
wherein the method further comprises:
acquiring the size of the residual file of the file to be uploaded;
judging whether the size of the residual file is larger than the preset threshold value or not;
when the size of the residual file is determined to be larger than the preset threshold value, continuously determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the size of the file, the total step length of the uploading progress bar and the real-time network speed, and refreshing the uploading progress bar according to the real-time refreshing speed;
When the size of the residual file is determined to be smaller than or equal to the preset threshold, determining the residual refreshing times of the uploading progress bar based on the refreshing speed, the size of the residual file and the average network speed;
obtaining the remaining step length of the uploading progress bar;
and refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
2. The method of claim 1, wherein the determining the number of refreshments of the upload progress bar according to the refresh rate, the file size, and the average network speed comprises:
determining the total uploading duration of the file to be uploaded according to the average network speed and the size of the file;
and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
3. The method of claim 1, wherein the refreshing the upload progress bar according to the refresh times and a preset total step size of the upload progress bar comprises:
determining a single refreshing step length for refreshing the uploading progress bar according to the refreshing times and a preset total step length of the uploading progress bar;
And refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
4. A progress bar refreshing apparatus, the apparatus comprising:
the file size acquisition module is used for acquiring the size of a file to be uploaded;
the display module is used for displaying an uploading progress bar;
the refreshing speed determining module is used for judging whether the file size of the file to be uploaded is smaller than or equal to a preset threshold value or not; when the file size is determined to be smaller than or equal to the preset threshold, acquiring the average network speed of an uploading network and the refreshing speed of the uploading progress bar, wherein the refreshing speed is the interval duration of the uploading progress bar for refreshing once;
the updating time determining module is used for determining the updating time of the uploading progress bar according to the updating speed, the file size and the average network speed;
the refreshing module is used for refreshing the uploading progress bar according to the refreshing times and a preset total step length of the uploading progress bar, wherein the total step length is the number of unit step lengths which are decomposed from the total progress length of the uploading progress bar;
the real-time network speed acquisition module is used for acquiring the real-time network speed of the uploading network when the file size is determined to be larger than the preset threshold value;
The real-time refreshing speed determining module is used for determining the real-time refreshing speed of the refreshing unit step length of the uploading progress bar according to the file size, the total step length of the uploading progress bar and the real-time network speed;
the real-time refreshing module is used for refreshing the uploading progress bar according to the real-time refreshing speed;
the device further comprises:
a residual file size obtaining module, configured to obtain a residual file size of the file to be uploaded;
the threshold value judging module is used for judging whether the size of the residual file is larger than the preset threshold value or not;
a continuous execution module, configured to, when it is determined that the size of the remaining file is greater than the preset threshold, continue to determine a real-time refresh rate of a refresh unit step of the upload progress bar according to the size of the file, the total step of the upload progress bar, and the real-time network speed, and refresh the upload progress bar according to the real-time refresh rate;
a remaining refresh number determination module, configured to determine, when it is determined that the size of the remaining file is smaller than or equal to the preset threshold, the remaining refresh number of the upload progress bar based on the refresh rate, the size of the remaining file, and the average network speed;
The residual step length determining module is used for obtaining the residual step length of the uploading progress bar;
and the continuous refreshing module is used for refreshing the uploading progress bar according to the residual step length and the residual refreshing times.
5. The apparatus according to claim 4, wherein the refresh number determining module is specifically configured to determine a total uploading duration of the file to be uploaded according to the average network speed and the file size;
and determining the refreshing times of the uploading progress bar according to the total uploading duration and the refreshing speed.
6. The device according to claim 4, wherein the refresh module is specifically configured to determine a single refresh step length for refreshing the upload progress bar according to the refresh times and a preset total step length of the upload progress bar;
and refreshing the uploading progress bar according to the refreshing speed based on the single refreshing step length.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 3 when executing the computer program.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 3.
CN202110521474.0A 2021-05-13 2021-05-13 Progress bar refreshing method and device, computer equipment and readable storage medium Active CN113296860B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110521474.0A CN113296860B (en) 2021-05-13 2021-05-13 Progress bar refreshing method and device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110521474.0A CN113296860B (en) 2021-05-13 2021-05-13 Progress bar refreshing method and device, computer equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113296860A CN113296860A (en) 2021-08-24
CN113296860B true CN113296860B (en) 2022-07-29

Family

ID=77321873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110521474.0A Active CN113296860B (en) 2021-05-13 2021-05-13 Progress bar refreshing method and device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113296860B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778055A (en) * 2014-01-15 2015-07-15 腾讯科技(深圳)有限公司 Method and device for displaying progress bar
CN105988913A (en) * 2015-02-27 2016-10-05 阿里巴巴集团控股有限公司 Progress indication method and device
CN112486783A (en) * 2020-11-25 2021-03-12 建信金融科技有限责任公司 Progress bar display method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170500A (en) * 2017-11-28 2018-06-15 深圳市金立通信设备有限公司 Download progress method for refreshing, terminal device and computer readable storage medium
US10956015B1 (en) * 2019-09-11 2021-03-23 International Business Machines Corporation User notification based on visual trigger event

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778055A (en) * 2014-01-15 2015-07-15 腾讯科技(深圳)有限公司 Method and device for displaying progress bar
CN105988913A (en) * 2015-02-27 2016-10-05 阿里巴巴集团控股有限公司 Progress indication method and device
CN112486783A (en) * 2020-11-25 2021-03-12 建信金融科技有限责任公司 Progress bar display method and device

Also Published As

Publication number Publication date
CN113296860A (en) 2021-08-24

Similar Documents

Publication Publication Date Title
CN111143462B (en) Method, apparatus, computer device and storage medium for data export
CN108763398B (en) Database configuration parameter processing method and device, computer equipment and storage medium
CN108830900B (en) Method and device for processing jitter of key point
CN110569222B (en) Link tracking method and device, computer equipment and readable storage medium
CN109542962B (en) Data processing method, data processing device, computer equipment and storage medium
CN112000903B (en) Data query method and device, computer equipment and storage medium
JP2015505629A (en) Information search method and server
CN110471585A (en) Function of application icon methods of exhibiting, device and computer equipment
CN112114914A (en) Method and device for generating report, computer equipment and storage medium
CN110363580B (en) Information recommendation method and device, computer equipment and storage medium
CN111191167A (en) Page resource updating method and device, computer equipment and storage medium
CN110888709A (en) Intelligent operation method and device of monitoring screen, computer equipment and storage medium
CN110321467A (en) Airport engineering project information methods of exhibiting, device, system, equipment and medium
CN110457401B (en) Data storage method and device, computer equipment and storage medium
CN112104981A (en) Terminal positioning track generation method and device and electronic equipment
CN113296860B (en) Progress bar refreshing method and device, computer equipment and readable storage medium
CN110716916A (en) Resource online management method and device, computer equipment and storage medium
CN111178126A (en) Target detection method, target detection device, computer equipment and storage medium
CN114491342B (en) Training method of personalized model, information display method and equipment
CN112989185B (en) Information pushing method, device, computer equipment and storage medium
CN110544306B (en) Three-dimensional terrain data acquisition method, three-dimensional terrain data acquisition device, computer equipment and storage medium
CN111382382B (en) Data display method, device, computer equipment and storage medium
CN109284260B (en) Big data file reading method and device, computer equipment and storage medium
CN113868127A (en) Online debugging method and device, computer equipment and storage medium
CN113256034B (en) Information delivery method and device, electronic equipment and storage medium

Legal Events

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