CN106911749B - Method and device for notifying user of online and offline - Google Patents

Method and device for notifying user of online and offline Download PDF

Info

Publication number
CN106911749B
CN106911749B CN201510982733.4A CN201510982733A CN106911749B CN 106911749 B CN106911749 B CN 106911749B CN 201510982733 A CN201510982733 A CN 201510982733A CN 106911749 B CN106911749 B CN 106911749B
Authority
CN
China
Prior art keywords
user
online
dotting
deadline
user identifier
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.)
Expired - Fee Related
Application number
CN201510982733.4A
Other languages
Chinese (zh)
Other versions
CN106911749A (en
Inventor
左文建
曲文庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510982733.4A priority Critical patent/CN106911749B/en
Publication of CN106911749A publication Critical patent/CN106911749A/en
Application granted granted Critical
Publication of CN106911749B publication Critical patent/CN106911749B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/535Tracking the activity of the user

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a method and a device for notifying a user of online and offline. The method comprises the following steps: when dotting data comprising a dotting user identifier is received, setting an online deadline corresponding to the dotting user identifier; if the user corresponding to the dotting user identification is judged to be online for the first time, sending an online notification of the user corresponding to the dotting user identification; sequencing all the stored user identifications according to the corresponding online deadline; for all the user identifications after sequencing, sequentially judging whether the online deadline corresponding to the current user identification is reached according to the sequencing sequence, and stopping judging until the online deadline corresponding to a certain user identification is not reached; and sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached. The invention has smaller query quantity and can inform the online and offline conditions of the user in more time.

Description

Method and device for notifying user of online and offline
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method and a device for notifying a user of an online/offline status.
Background
With the rapid development of network technology, various websites are emerging continuously, and in order to facilitate the maintenance of websites, it is usually necessary to monitor the online status of a website user and trigger the notification of online and offline of the user. However, when the number of online users reaches ten thousand, it becomes difficult to monitor the online condition of the website user. For example, an online user sends heartbeat information to a server, when the heartbeat information is sent for the first time, the user is indicated to be online, and when the heartbeat information of the user is not received within 3 heartbeat intervals, the user is judged to be offline. If 120 universal users are online at the website platform currently and a heartbeat is sent every 10 seconds, the server is required to reach 12 ten thousand QPS (query per Second), and if the website platform is a common Web server (1000QPS), 120 groups of services are required to be accepted.
In the prior art, heartbeat information of an online user is recorded in a database in a session mode, the session corresponding to the user is created when the user is online, the life cycle of the corresponding session is prolonged when the user sends the heartbeat information again, the user is determined to be offline after a certain time without the heartbeat information of the user, and the session corresponding to the user is automatically deleted. However, in the above method, the life cycle of the session corresponding to each user in the database needs to be queried one by one, and the query quantity is very large, so that the online and offline notification to the user is not timely.
Disclosure of Invention
In view of the above problems, the present invention has been made to provide a method of notifying a user of an online or offline status and a corresponding apparatus for notifying a user of an online or offline status that overcome or at least partially solve the above problems.
According to an aspect of the present invention, there is provided a method for notifying a user of an online or offline status, comprising:
when dotting data comprising a dotting user identifier is received, setting an online deadline corresponding to the dotting user identifier;
if the user corresponding to the dotting user identification is judged to be online for the first time, sending an online notification of the user corresponding to the dotting user identification;
sequencing all the stored user identifications according to the corresponding online deadline;
for all the user identifications after sequencing, sequentially judging whether the online deadline corresponding to the current user identification is reached according to the sequencing sequence, and stopping judging until the online deadline corresponding to a certain user identification is not reached;
and sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached.
Optionally, the step of sequentially determining, according to the sorting order, whether the online deadline corresponding to the current user identifier has arrived for all the sorted user identifiers, and stopping the determination until the online deadline corresponding to a certain user identifier has not arrived includes:
and for all the sorted user identifications, sequentially judging whether the online deadline corresponding to the current user identification is earlier than the current time or not from the user identification with the earliest online deadline according to the sorting sequence, and stopping judging until the online deadline corresponding to a certain user identification is equal to or later than the current time.
Optionally, when the dotting data including a dotting user identifier is received, before the step of setting the online deadline corresponding to the dotting user identifier, the method further includes:
the user identifications are divided into a plurality of groups, and a corresponding independent processing thread is created for each group of user identifications.
Optionally, the step of setting an online deadline corresponding to the dotting user identifier when receiving dotting data including the dotting user identifier includes: when dotting data comprising a dotting user identifier is received, forwarding the dotting data to an independent processing thread corresponding to the dotting user identifier, and setting online deadline time corresponding to the dotting user identifier by the independent processing thread;
the step of sorting all the stored user identifiers according to the corresponding online deadline comprises the following steps: aiming at each group of user identifications, sequencing all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline;
the step of sequentially judging whether the online deadline corresponding to the current user identifier has arrived according to the sorting order for all the sorted user identifiers comprises the following steps: and for each group of sorted user identifications, respectively and sequentially judging whether the online deadline corresponding to the current user identification is reached by the corresponding independent processing thread according to the sorting sequence.
Optionally, the step of setting an online deadline corresponding to the dotting user identifier includes:
determining whether the dotting user identification is saved;
if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time;
if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
Optionally, if it is determined that the user corresponding to the dotting user identifier is online for the first time, the step of sending the online notification of the user corresponding to the dotting user identifier includes:
determining whether the dotting user identification is saved;
if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
According to another aspect of the present invention, there is provided an apparatus for notifying a user of an online or offline status, comprising:
the system comprises a setting module, a data processing module and a data processing module, wherein the setting module is suitable for setting online deadline time corresponding to a dotting user identifier when receiving dotting data comprising the dotting user identifier;
the online notification module is suitable for sending an online notification of a user corresponding to the dotting user identifier if the user corresponding to the dotting user identifier is judged to be online for the first time;
the sorting module is suitable for sorting all the stored user identifications according to the corresponding online deadline;
the judging module is suitable for sequentially judging whether the online deadline corresponding to the current user identifier is reached according to the sequencing sequence for all the sequenced user identifiers, and stopping judging until the online deadline corresponding to a certain user identifier is not reached;
and the offline notification module is suitable for sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached.
Optionally, the determining module is specifically adapted to, for all the sorted user identifiers, sequentially determine, according to the sorting order, whether the online deadline corresponding to the current user identifier is earlier than the current time from the user identifier with the earliest online deadline, and stop the determination until the online deadline corresponding to a certain user identifier is equal to or later than the current time.
Optionally, the apparatus further comprises: and the grouping module is suitable for dividing the user identifications into a plurality of groups and creating a corresponding independent processing thread for each group of user identifications.
Optionally, the setting module is specifically adapted to, when receiving dotting data including a dotting user identifier, forward the dotting data to an independent processing thread corresponding to the dotting user identifier, and set, by the independent processing thread, an online deadline corresponding to the dotting user identifier;
the sorting module is specifically suitable for sorting all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline aiming at each group of user identifications;
the judging module is specifically adapted to sequentially judge whether the online deadline corresponding to the current user identifier has arrived by the respective corresponding independent processing thread according to the sorting order for each group of sorted user identifiers.
Optionally, the setting module is specifically adapted to determine whether the dotting user identifier is already saved; if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time; if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
Optionally, the online notification module is specifically adapted to determine whether the dotting user identifier is already stored; if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
According to the method and the device for notifying the online and offline of the user, when the dotting data of the dotting user is received, the online deadline time corresponding to the dotting user identification is set, whether the user corresponding to the dotting user identification is online for the first time is judged, and if yes, the online notification of the user corresponding to the dotting user identification is sent; and sequencing all the stored user identifications according to the corresponding online deadline time, sequentially judging whether the online deadline time corresponding to the current user identification reaches for all the sequenced user identifications according to the sequencing sequence, stopping judging until the online deadline time corresponding to a certain user identification does not reach, and sending offline notification of the user corresponding to the user identification aiming at the user identification of which the corresponding online deadline time reaches. Therefore, the invention does not need to query all the user identifications one by one, and only needs to judge part of the sequenced user identifications, so that the query quantity is small, and the online and offline conditions of the user can be notified in a more timely manner.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a third embodiment of the present invention;
FIG. 4 is a block diagram of an apparatus for notifying a user of an online/offline status according to a fourth embodiment of the present invention;
fig. 5 is a block diagram illustrating an apparatus for notifying a user of an online/offline status according to a fifth embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example one
Referring to fig. 1, a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a first embodiment of the present invention is shown. The method of the embodiment may include the steps of:
step 101, when receiving dotting data including a dotting user identifier, setting an online deadline corresponding to the dotting user identifier.
At present, most of service statistical data are completed by depending on dotting of a browser end, namely, the browser sends dotting data to a server by initiating a dotting request, and the server records the dotting data. The dotting data is service data of the function point, for example, when a user clicks a link on a web page, the click information of the link is the dotting data.
In this embodiment, the dotting data may be heartbeat information sent by the user, where the heartbeat information of the user is sent every preset time (for example, 10 s) for each online user. The dotting data may include a dotting user identifier of a user who sends the dotting data, and when the dotting data is received, the online deadline corresponding to the dotting user identifier is set.
And 102, if the user corresponding to the dotting user identification is judged to be online for the first time, sending an online notification of the user corresponding to the dotting user identification.
When receiving the dotting data, judging whether the user corresponding to the dotting user identification is on-line for the first time or not so as to determine whether on-line notification of the user corresponding to the dotting user identification needs to be sent or not, and if the user corresponding to the dotting user identification is on-line for the first time, sending the on-line notification of the user corresponding to the dotting user identification.
It should be noted that, in the above step 101, the process of setting the online deadline time corresponding to the dotting user identifier is not strictly ordered to the process of sending the online notification of the user corresponding to the dotting user identifier if it is determined that the user corresponding to the dotting user identifier is online for the first time in step 102, and both the processes are executed when the dotting data is received, and may be executed sequentially or simultaneously.
And 103, sequencing all the stored user identifications according to the corresponding online deadline.
And each stored user identifier corresponds to an online deadline, and all the stored user identifiers are sorted according to the corresponding online deadline. The sorting may be ascending sorting or descending sorting, which is not limited in this embodiment.
It should be noted that, the foregoing steps 101, 102 and 103 are not strictly ordered, and are all executed when the conditions are satisfied. For example, step 101 and step 102 are executed when dotting data is received, step 103 may be executed after step 101, or after step 102, or may be executed according to a set condition, such as real-time execution, or executed according to a set time interval (e.g., step 102 is executed every 30 s), and the like, which is not limited in this embodiment of the present invention.
And step 104, sequentially judging whether the online deadline corresponding to the current user identifier is reached according to the sequencing sequence for all the user identifiers after sequencing, and stopping judging until the online deadline corresponding to a certain user identifier is not reached.
In the process, the user identification of which the online deadline is reached is only needed to be judged, and the user identification of which the rest online deadline is not reached is not needed to be judged again, so that all the user identifications are not needed to be inquired, only part of the user identifications are needed to be judged, and the inquiry amount is greatly reduced.
And 105, sending an offline notification of a user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached.
According to the determination result in step 104, for the user identifier whose corresponding online deadline has been reached, it may be determined that the user corresponding to the user identifier has been offline, and therefore, an offline notification may be sent for the user who has been offline.
According to the embodiment of the invention, all the user identifications do not need to be inquired one by one, and only part of the sorted user identifications need to be judged, so that the inquiry quantity is small, and the online and offline conditions of the user can be informed in a more timely manner.
Example two
Referring to fig. 2, a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a second embodiment of the present invention is shown. The method of the embodiment may include the steps of:
step 201, a receiving thread receives dotting data including a dotting user identifier, and when the dotting data is received, the dotting data is sent to a processing thread.
In this embodiment, the receiving thread is configured to receive dotting data sent by a user, the processing thread is configured to execute subsequent processing, the receiving thread and the processing thread can communicate with each other, and the receiving thread sends the dotting data to the processing thread when receiving the dotting data.
Preferably, when the receiving thread receives the dotting data in step 201, the process of sending the dotting data to the processing thread may include: and when receiving the dotting data, the receiving thread sends the dotting data to the processing thread according to a User Datagram Protocol (UDP). And the data transmission is carried out according to the UDP, so that the internal data transmission efficiency can be effectively improved.
Preferably, when the receiving thread receives the dotting data in step 201, the process of sending the dotting data to the processing thread may be completed by the Nginx server. The Nginx is a lightweight Web server, a reverse proxy server, and an email (IMAP/POP3) proxy server, and the performance of the Nginx server is high, and the processing efficiency can be improved.
Step 202, the processing thread sets the online deadline corresponding to the dotting user identifier.
The dotting data comprises a dotting user identifier, and the processing thread sets the online deadline corresponding to the dotting user identifier after receiving the dotting data.
Preferably, this step 202 may comprise the following sub-steps:
sub-step a1, determining whether the dotting user identification has been saved. If yes, perform substep a2, otherwise perform substep a 3.
And a substep a2, updating the online deadline corresponding to the dotting user identifier to a time obtained by adding the set time to the current time.
And a substep a3, storing the dotting user identifier, and setting the online deadline corresponding to the dotting user identifier as the time obtained by adding the current time to the set time.
When a certain user is online, the user identifier of the user is stored in the server, that is, the user identifier of the user who is online before is stored in the server. Each user identification is corresponding to an online deadline, and the online deadline indicates that the user corresponding to the user identification is considered to be offline after the online deadline is reached. Preferably, in this embodiment, a hash table may be used to establish a corresponding relationship between the user identifier and the online deadline, so that a faster query can be implemented.
After receiving the dotting data, the processing thread determines whether the dotting user identification is stored or not so as to determine whether the user corresponding to the dotting user identification sends the dotting data for the first time (that is, whether the user is not on line before), and if the dotting user identification is stored, the online deadline time corresponding to the dotting user identification can be directly updated to the time obtained by adding the set time to the current time; if the dotting user identifier is not stored, the dotting user identifier is stored firstly (namely, the dotting user identifier is added in the server to indicate that the user is online), and the online deadline time corresponding to the dotting user identifier is set as the time obtained by adding the set time to the current time. For the setting time, a person skilled in the art may select any suitable value according to practical experience, for example, the setting time may be set to 30s, 1min, and the like, and the specific value is not limited in this embodiment.
And 203, if the processing thread judges that the user corresponding to the dotting user identification is online for the first time, sending an online notification of the user corresponding to the dotting user identification.
The processing thread judges whether the user corresponding to the dotting user identification is online for the first time, if the user corresponding to the dotting user identification is online for the first time, the processing thread can send an online notification of the user corresponding to the dotting user identification to the user online and offline event interface, and the online condition of the user can be known in time by sending the online notification of the user.
Preferably, this step 203 may comprise: determining whether the dotting user identification is saved; if so, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification, otherwise, not processing, namely, not sending the online notification of the user corresponding to the dotting user identification.
It should be noted that, in this embodiment, the order of executing step 202 and step 203 is not limited, step 202 may be executed first and then step 203 may be executed, step 203 may be executed first and then step 202 may be executed, or step 202 and step 203 may be executed concurrently.
And step 204, sequencing all the stored user identifications by the processing thread according to the corresponding online deadline.
The sorting may be ascending sorting according to the online deadline, or descending sorting according to the online deadline, which is not limited in this embodiment.
And step 205, the processing thread sequentially judges whether the online deadline corresponding to the current user identifier has arrived according to the sorting order for all the user identifiers after sorting, and stops judging until the online deadline corresponding to a certain user identifier does not arrive.
Preferably, this step 205 may comprise: and for all the sorted user identifications, sequentially judging whether the online deadline corresponding to the current user identification is earlier than the current time or not from the user identification with the earliest online deadline according to the sorting sequence, and stopping judging until the online deadline corresponding to a certain user identification is equal to or later than the current time.
In this embodiment, the determination is started from the user identifier with the earliest corresponding online deadline, and if the online deadline corresponding to the user identifier is earlier than the current time, it is determined that the online deadline has reached, that is, the user corresponding to the user identifier may have been offline, and at this time, the determination is continued for the next user identifier; if the online deadline corresponding to the user identifier is equal to or later than the current time, determining that the online deadline has not arrived, that is, the user corresponding to the user identifier has not been offline, and at this time, because the online deadline corresponding to the user identifier below the user identifier is later than the online deadline corresponding to the user identifier, directly determining that the online deadline corresponding to the user identifier below the user identifier has not arrived, that is, the user corresponding to the user identifier below the user identifier has not been offline, and thus, no further determination is needed.
In step 206, the processing thread sends an offline notification of the user corresponding to the user identifier for which the corresponding online deadline has been reached.
After the determination in step 205, the processing thread may obtain the user identifiers whose corresponding online deadline has been reached according to the determination result, and determine that the users corresponding to the user identifiers have been offline, so that the processing thread may send an offline notification of the user corresponding to the user identifier to the user offline event interface for the user identifier whose corresponding online deadline has been reached. By sending the offline notification of the user, the offline condition of the user can be known in time.
Preferably, in this embodiment, after the step 205, the method may further include: and the processing thread counts the number of the online users according to the judgment result. After the determination in step 205, the number of online users may be counted according to the determination result, and the counting process may specifically include: the processing thread determines the number of user identifications for which the corresponding online expiration time has been reached, and takes this number as the number of online users. By counting the number of online users, the current burden condition of the website can be known in time, and the website is convenient to maintain and upgrade.
According to the embodiment of the invention, all the user identifications do not need to be inquired one by one, and only part of the sorted user identifications need to be judged, so that the inquiry quantity is small, and the online and offline conditions of the user can be informed in a more timely manner.
EXAMPLE III
Referring to fig. 3, a flowchart illustrating steps of a method for notifying a user of an online/offline status according to a third embodiment of the present invention is shown. The method of the embodiment may include the steps of:
step 301, dividing the user identifiers into a plurality of groups, and creating a corresponding independent processing thread for each group of user identifiers.
In this embodiment, the user identifier may be divided into a plurality of groups according to a set manner, and for a specific division manner, a person skilled in the art may select any suitable manner according to actual experience, which is not limited in this embodiment of the present invention. For example, the user identities 1-10000 can be divided into a group, the user identities 10001-20000 can be divided into a group, and so on.
For each group of subscriber identities, a corresponding independent processing thread may be created, which is mainly used for processing events related to the corresponding group of subscriber identities.
Step 302, when receiving dotting data including a dotting user identifier, forwarding the dotting data to an independent processing thread corresponding to the dotting user identifier.
When receiving dotting data comprising a dotting user identifier, firstly determining a group to which the dotting user identifier belongs, and after determining, forwarding the dotting data to an independent processing thread corresponding to the dotting user identifier, namely a corresponding independent processing thread created for the user identifier in the group to which the dotting user identifier belongs.
Step 303, setting an online deadline corresponding to the dotting user identifier by an independent processing thread corresponding to the dotting user identifier.
After receiving the dotting data, the independent processing thread corresponding to the dotting user identifier may set the online deadline corresponding to the dotting user identifier, and for a specific process of setting the online deadline corresponding to the dotting user identifier, reference may be made to the related description of step 202 in the second embodiment, which is not discussed in detail herein in this embodiment.
And 304, when the independent processing thread corresponding to the dotting user identifier judges that the user corresponding to the dotting user identifier is the first online user, sending an online notification of the user corresponding to the dotting user identifier.
For the specific process of step 304, reference may be made to the related description of step 203 in the second embodiment, and this embodiment will not be discussed in detail here.
And 305, for each group of user identifications, respectively sequencing all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline.
For the sorting process of each independent processing thread, reference may be made to the related description of step 204 in the second embodiment, and this embodiment will not be discussed in detail here.
And step 306, sequentially judging whether the online deadline corresponding to the current user identifier is reached or not by the respective corresponding independent processing thread according to the sorting sequence aiming at each group of sorted user identifiers, and stopping judging until the online deadline corresponding to a certain user identifier is not reached.
For the determination process of each independent processing thread, reference may be made to the related description of step 205 in the second embodiment, and details of the determination process are not discussed here.
Step 307, for each group of sorted user identifiers, sending an offline notification of the user corresponding to the user identifier by the corresponding independent processing thread for the user identifier whose online deadline time has been reached in the group.
Preferably, in this embodiment, after the step 306, the method may further include: and counting the number of the group of online users by the corresponding independent processing threads according to the respective judgment results aiming at each group of sequenced user identifications, and determining the number of all online users according to the counting results of the independent threads. After each independent processing thread obtains its own statistical result (that is, the number of online users in a group of user identifiers corresponding to each independent processing thread), the statistical results of each independent processing thread are added, and the result obtained after the addition is the number of all online users.
In this embodiment, the user identifier is divided into a plurality of groups, and a plurality of independent processing threads are set to respectively process the related processes of the plurality of groups, so that the processing of the dotting data is more timely, and the QPS that can be assumed is higher.
For simplicity of explanation, the method embodiments are described as a series of acts or combinations, but those skilled in the art will appreciate that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the embodiments of the invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Example four
Referring to fig. 4, a block diagram of an apparatus for notifying a user of an online/offline status according to a fourth embodiment of the present invention is shown. The apparatus of this embodiment may include the following modules:
the setting module 401 is adapted to set an online deadline corresponding to a dotting user identifier when dotting data including the dotting user identifier is received;
an online notification module 402, adapted to send an online notification of a user corresponding to the dotting user identifier if it is determined that the user corresponding to the dotting user identifier is online for the first time;
a sorting module 403 adapted to sort all the stored user identifiers according to the corresponding online deadline;
a determining module 404, adapted to sequentially determine, for all the sorted user identifiers, whether the online deadline corresponding to the current user identifier has arrived according to the sorting order, and stop the determination until the online deadline corresponding to a certain user identifier has not arrived;
and the offline notification module 405 is adapted to send an offline notification of a user corresponding to the user identifier for which the corresponding online deadline has been reached.
According to the embodiment of the invention, all the user identifications do not need to be inquired one by one, and only part of the sorted user identifications need to be judged, so that the inquiry quantity is small, and the online and offline conditions of the user can be informed in a more timely manner.
EXAMPLE five
Referring to fig. 5, a block diagram of an apparatus for notifying a user of an online/offline status according to a fifth embodiment of the present invention is shown. The apparatus of this embodiment may include the following modules:
the setting module 501 is adapted to set an online deadline corresponding to a dotting user identifier when dotting data including the dotting user identifier is received;
an online notification module 502, adapted to send an online notification of a user corresponding to the dotting user identifier if it is determined that the user corresponding to the dotting user identifier is online for the first time;
a sorting module 503, adapted to sort all the stored user identifiers according to the corresponding online deadline;
a determining module 504, adapted to sequentially determine, for all the sorted user identifiers, whether the online deadline corresponding to the current user identifier has arrived according to the sorting order, and stop the determination until the online deadline corresponding to a certain user identifier has not arrived;
and the offline notification module 505 is adapted to send an offline notification of the user corresponding to the user identifier for which the corresponding online deadline has been reached.
Preferably, the determining module is specifically adapted to sequentially determine, for all the sorted user identifiers, whether the online deadline corresponding to the current user identifier is earlier than the current time according to the sorting order, starting from the user identifier with the earliest online deadline, and stopping the determination until the online deadline corresponding to a certain user identifier is equal to or later than the current time.
Preferably, the setting module is specifically adapted to determine whether the dotting user identifier has been saved; if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time; if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
Preferably, the online notification module is specifically adapted to determine whether the dotting user identifier is already saved; if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
Preferably, the apparatus of this embodiment may further include: the grouping module 506 is adapted to divide the user identifiers into a plurality of groups and create a corresponding independent processing thread for each group of user identifiers. Correspondingly, the setting module is specifically adapted to forward dotting data to an independent processing thread corresponding to a dotting user identifier when the dotting data including the dotting user identifier is received, and the independent processing thread sets an online deadline time corresponding to the dotting user identifier; the sorting module is specifically suitable for sorting all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline aiming at each group of user identifications; the judging module is specifically adapted to sequentially judge whether the online deadline corresponding to the current user identifier has arrived by the respective corresponding independent processing thread according to the sorting order for each group of sorted user identifiers.
According to the embodiment of the invention, all the user identifications do not need to be inquired one by one, and only part of the sorted user identifications need to be judged, so that the inquiry quantity is small, and the online and offline conditions of the user can be informed more timely; and the processing of the point data is more timely and the borne QPS is higher by setting a plurality of independent processing threads to respectively process the related processes of a plurality of groups.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the device for notifying a user of an up or down line according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The invention discloses A1, a method for notifying a user of online and offline, which comprises the following steps:
when dotting data comprising a dotting user identifier is received, setting an online deadline corresponding to the dotting user identifier;
if the user corresponding to the dotting user identification is judged to be online for the first time, sending an online notification of the user corresponding to the dotting user identification;
sequencing all the stored user identifications according to the corresponding online deadline;
for all the user identifications after sequencing, sequentially judging whether the online deadline corresponding to the current user identification is reached according to the sequencing sequence, and stopping judging until the online deadline corresponding to a certain user identification is not reached;
and sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached.
A2, the method as in a1, where the step of sequentially determining, for all sorted user identifiers, whether the online deadline corresponding to the current user identifier has arrived according to the sorting order, and stopping the determination until the online deadline corresponding to a certain user identifier has not arrived includes:
and for all the sorted user identifications, sequentially judging whether the online deadline corresponding to the current user identification is earlier than the current time or not from the user identification with the earliest online deadline according to the sorting sequence, and stopping judging until the online deadline corresponding to a certain user identification is equal to or later than the current time.
A3, the method as in a1, further comprising, before the step of setting an online deadline corresponding to a dotting user identifier when the dotting data including the dotting user identifier is received, the step of:
the user identifications are divided into a plurality of groups, and a corresponding independent processing thread is created for each group of user identifications.
A4, the method as in A3, wherein the step of setting the online deadline corresponding to the dotting user identifier when receiving the dotting data including the dotting user identifier includes: when dotting data comprising a dotting user identifier is received, forwarding the dotting data to an independent processing thread corresponding to the dotting user identifier, and setting online deadline time corresponding to the dotting user identifier by the independent processing thread;
the step of sorting all the stored user identifiers according to the corresponding online deadline comprises the following steps: aiming at each group of user identifications, sequencing all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline;
the step of sequentially judging whether the online deadline corresponding to the current user identifier has arrived according to the sorting order for all the sorted user identifiers comprises the following steps: and for each group of sorted user identifications, respectively and sequentially judging whether the online deadline corresponding to the current user identification is reached by the corresponding independent processing thread according to the sorting sequence.
A5, the method as in A1, the step of setting the online deadline corresponding to the dotting user identifier comprises:
determining whether the dotting user identification is saved;
if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time;
if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
A6, the method according to a1, wherein if it is determined that the user corresponding to the dotting user identifier is online for the first time, the step of sending an online notification of the user corresponding to the dotting user identifier includes:
determining whether the dotting user identification is saved;
if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
The invention also discloses B7, a device for informing users of on-line and off-line, comprising:
the system comprises a setting module, a data processing module and a data processing module, wherein the setting module is suitable for setting online deadline time corresponding to a dotting user identifier when receiving dotting data comprising the dotting user identifier;
the online notification module is suitable for sending an online notification of a user corresponding to the dotting user identifier if the user corresponding to the dotting user identifier is judged to be online for the first time;
the sorting module is suitable for sorting all the stored user identifications according to the corresponding online deadline;
the judging module is suitable for sequentially judging whether the online deadline corresponding to the current user identifier is reached according to the sequencing sequence for all the sequenced user identifiers, and stopping judging until the online deadline corresponding to a certain user identifier is not reached;
and the offline notification module is suitable for sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached.
B8, the apparatus according to B7, wherein the determining module is specifically adapted to sequentially determine, for all sorted user ids, whether the online deadline corresponding to the current user id is earlier than the current time in the sorting order from the user id with the earliest online deadline, and stop the determination until the online deadline corresponding to a certain user id is equal to or later than the current time.
B9, the apparatus of B7, further comprising:
and the grouping module is suitable for dividing the user identifications into a plurality of groups and creating a corresponding independent processing thread for each group of user identifications.
B10, the apparatus according to B9, wherein the setting module is specifically adapted to, when receiving dotting data including a dotting user identifier, forward the dotting data to an independent processing thread corresponding to the dotting user identifier, and set an online deadline corresponding to the dotting user identifier by the independent processing thread;
the sorting module is specifically suitable for sorting all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline aiming at each group of user identifications;
the judging module is specifically adapted to sequentially judge whether the online deadline corresponding to the current user identifier has arrived by the respective corresponding independent processing thread according to the sorting order for each group of sorted user identifiers.
B11, the apparatus as in B7, the setting module being adapted to determine whether the dotting user id has been saved; if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time; if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
B12, the apparatus as in B7, the online notification module being specifically adapted to determine whether the dotting user id has been saved; if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.

Claims (8)

1. A method of notifying a user of an online or offline event, comprising:
when dotting data comprising a dotting user identifier is received, setting an online deadline corresponding to the dotting user identifier;
if the user corresponding to the dotting user identification is judged to be online for the first time, sending an online notification of the user corresponding to the dotting user identification;
sequencing all the stored user identifications according to the corresponding online deadline;
for all the user identifications after sequencing, sequentially judging whether the online deadline corresponding to the current user identification is reached according to the sequencing sequence, and stopping judging until the online deadline corresponding to a certain user identification is not reached;
sending an offline notification of a user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached;
when the dotting data including the dotting user identification is received, before the step of setting the online deadline time corresponding to the dotting user identification, the method further includes:
dividing the user identifications into a plurality of groups, and creating a corresponding independent processing thread for each group of user identifications;
when receiving dotting data comprising a dotting user identifier, the step of setting the online deadline corresponding to the dotting user identifier comprises the following steps: when dotting data comprising a dotting user identifier is received, forwarding the dotting data to an independent processing thread corresponding to the dotting user identifier, and setting online deadline time corresponding to the dotting user identifier by the independent processing thread;
the step of sorting all the stored user identifiers according to the corresponding online deadline comprises the following steps: aiming at each group of user identifications, sequencing all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline;
the step of sequentially judging whether the online deadline corresponding to the current user identifier has arrived according to the sorting order for all the sorted user identifiers comprises the following steps: and for each group of sorted user identifications, respectively and sequentially judging whether the online deadline corresponding to the current user identification is reached by the corresponding independent processing thread according to the sorting sequence.
2. The method as claimed in claim 1, wherein the step of sequentially determining whether the online deadline corresponding to the current user identifier has arrived according to the sorting order for all the sorted user identifiers until the online deadline corresponding to a certain user identifier has not arrived, the step of stopping the determination comprises:
and for all the sorted user identifications, sequentially judging whether the online deadline corresponding to the current user identification is earlier than the current time or not from the user identification with the earliest online deadline according to the sorting sequence, and stopping judging until the online deadline corresponding to a certain user identification is equal to or later than the current time.
3. The method of claim 1, wherein the step of setting an online deadline corresponding to the dotting user identifier comprises:
determining whether the dotting user identification is saved;
if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time;
if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
4. The method of claim 1, wherein the step of sending an online notification of the user corresponding to the dotting user identifier if it is determined that the user corresponding to the dotting user identifier is online for the first time comprises:
determining whether the dotting user identification is saved;
if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
5. An apparatus for notifying a user of an online or offline event, comprising:
the system comprises a setting module, a data processing module and a data processing module, wherein the setting module is suitable for setting online deadline time corresponding to a dotting user identifier when receiving dotting data comprising the dotting user identifier;
the online notification module is suitable for sending an online notification of a user corresponding to the dotting user identifier if the user corresponding to the dotting user identifier is judged to be online for the first time;
the sorting module is suitable for sorting all the stored user identifications according to the corresponding online deadline;
the judging module is suitable for sequentially judging whether the online deadline corresponding to the current user identifier is reached according to the sequencing sequence for all the sequenced user identifiers, and stopping judging until the online deadline corresponding to a certain user identifier is not reached;
the offline notification module is suitable for sending the offline notification of the user corresponding to the user identifier aiming at the user identifier of which the corresponding online deadline is reached;
the grouping module is suitable for dividing the user identifications into a plurality of groups and creating a corresponding independent processing thread for each group of user identifications;
the setting module is specifically suitable for forwarding dotting data to an independent processing thread corresponding to a dotting user identifier when the dotting data comprising the dotting user identifier is received, and setting the online deadline time corresponding to the dotting user identifier by the independent processing thread;
the sorting module is specifically suitable for sorting all the stored user identifications by the corresponding independent processing threads according to the corresponding online deadline aiming at each group of user identifications;
the judging module is specifically adapted to sequentially judge whether the online deadline corresponding to the current user identifier has arrived by the respective corresponding independent processing thread according to the sorting order for each group of sorted user identifiers.
6. The apparatus according to claim 5, wherein the determining module is specifically adapted to sequentially determine, for all the sorted ue identities, whether the online deadline corresponding to the current ue is earlier than the current time in the sorting order from the ue with the earliest online deadline, and stop the determination until the online deadline corresponding to a ue is equal to or later than the current time.
7. The apparatus of claim 5, wherein the setup module is specifically adapted to determine whether the dotting user identifier has been saved; if so, updating the online deadline time corresponding to the dotting user identifier to the time obtained by adding the current time to the set time; if not, the dotting user identification is saved, and the online deadline time corresponding to the dotting user identification is set as the time obtained by adding the current time to the set time.
8. The apparatus of claim 5, wherein the online notification module is specifically adapted to determine whether the dotting user identifier has been saved; if yes, judging that the user corresponding to the dotting user identification is online for the first time, and sending an online notification of the user corresponding to the dotting user identification.
CN201510982733.4A 2015-12-23 2015-12-23 Method and device for notifying user of online and offline Expired - Fee Related CN106911749B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510982733.4A CN106911749B (en) 2015-12-23 2015-12-23 Method and device for notifying user of online and offline

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510982733.4A CN106911749B (en) 2015-12-23 2015-12-23 Method and device for notifying user of online and offline

Publications (2)

Publication Number Publication Date
CN106911749A CN106911749A (en) 2017-06-30
CN106911749B true CN106911749B (en) 2020-06-26

Family

ID=59207231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510982733.4A Expired - Fee Related CN106911749B (en) 2015-12-23 2015-12-23 Method and device for notifying user of online and offline

Country Status (1)

Country Link
CN (1) CN106911749B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360783B (en) * 2021-06-21 2023-03-14 上海哔哩哔哩科技有限公司 User online list updating method and device and computer equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035130A (en) * 2007-01-18 2007-09-12 北京北大方正电子有限公司 Browser/server structure based information distribution method and system
CN101378326A (en) * 2008-09-18 2009-03-04 中兴通讯股份有限公司 Method for enquiring multicast user processing aging
CN102761438A (en) * 2012-05-18 2012-10-31 江苏金马扬名信息技术有限公司 Method, server and system for counting on-line user population of website
CN104317473A (en) * 2014-09-24 2015-01-28 广州华多网络科技有限公司 Interface display method and client
CN104836716A (en) * 2014-02-10 2015-08-12 腾讯科技(深圳)有限公司 Ordering method, apparatus and system based on relation chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035130A (en) * 2007-01-18 2007-09-12 北京北大方正电子有限公司 Browser/server structure based information distribution method and system
CN101378326A (en) * 2008-09-18 2009-03-04 中兴通讯股份有限公司 Method for enquiring multicast user processing aging
CN102761438A (en) * 2012-05-18 2012-10-31 江苏金马扬名信息技术有限公司 Method, server and system for counting on-line user population of website
CN104836716A (en) * 2014-02-10 2015-08-12 腾讯科技(深圳)有限公司 Ordering method, apparatus and system based on relation chain
CN104317473A (en) * 2014-09-24 2015-01-28 广州华多网络科技有限公司 Interface display method and client

Also Published As

Publication number Publication date
CN106911749A (en) 2017-06-30

Similar Documents

Publication Publication Date Title
US11755371B1 (en) Data intake and query system with distributed data acquisition, indexing and search
CN110830564B (en) CDN scheduling method, device, system and computer readable storage medium
WO2016131365A1 (en) Information processing method, client, server and computer readable storage medium
CN108183950B (en) Method and device for establishing connection of network equipment
US20140046968A1 (en) Data acquisition method, device and system
CN109787827B (en) CDN network monitoring method and device
CN103684911B (en) Website online user statistical method and device
WO2016023345A1 (en) Gated upgrade method and apparatus
CN106453460B (en) File distribution method, device and system
CN112039718B (en) Upgrade state detection method, server, equipment and storage medium
CN104298565B (en) A kind of method and device of initiating port
CN110555019A (en) Data cleaning method based on service end
CN111064772A (en) Vehicle service response method and system
WO2017185631A1 (en) Data downloading method and device
WO2015169028A1 (en) On-line upgrade method and device for terminal software
CN114124490A (en) Method and device for releasing new media content, storage medium and electronic equipment
CN106911749B (en) Method and device for notifying user of online and offline
CN113010379B (en) Electronic equipment monitoring system
CN105450737B (en) A kind of data processing method, device and system
CN106911528A (en) The method and apparatus of on-line user amount statistic
CN106911748A (en) The method and apparatus of on-line user amount statistic
CN111815059A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN115296979B (en) Fault processing method, device, equipment and storage medium
CN105099738B (en) Data capture method, apparatus and system
CA2828056A1 (en) Computer system for the exchange of messages

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200626

CF01 Termination of patent right due to non-payment of annual fee