Add a Priority Queue for Most Common Contacts #481
No reviewers
Labels
No Label
applications
BLOCKED
bug
design
duplicate
enhancement
fixed?
funding-needed
help wanted
infrastructure
invalid
payments
qubes
question
ready-for-implementation
refactor
spam
tapir-server
testing
tor
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cwtch.im/cwtch#481
Loading…
Reference in New Issue
No description provided.
Delete Branch "priority"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/90
@ -179,0 +180,4 @@
// do priority connections first...
for connectingCount < cr.maxTorCircuitsPending() && len(cr.priorityQueue.queue) > 0 {
for {
why the nested inner for loop?
@ -182,3 +198,1 @@
if contact.state == connections.DISCONNECTED {
cr.publishConnectionRequest(contact)
connectingCount++
for {
ditto
@ -826,3 +826,3 @@
lastSeen = cp.GetConversationLastSeenTime(ci.ID)
}
cp.eventBus.Publish(event.NewEvent(event.QueuePeerRequest, map[event.Field]string{event.RemotePeer: handle, event.LastSeen: lastSeen.Format(time.RFC3339Nano)}))
if !ci.ACL[ci.Handle].Blocked && ci.Accepted {
eek good catch thanks
@ -179,0 +182,4 @@
for connectingCount < cr.maxTorCircuitsPending() && len(cr.priorityQueue.queue) > 0 {
for {
contact := cr.priorityQueue.dequeue()
if contact == nil {
you shouldnt need this if it's just in the outer loop, as there's a reoccuring check the queue len is > 0
@ -223,1 +247,3 @@
cr.pendingQueue.insert(contact)
// prioritize connections made in the last week
if time.Since(contact.lastSeen).Hours() < 168 {
define 168 as something like PriorityQueueTimeSinceQualifierHours or... umm.. something less unwordly so we can tweak it in one place instead of two
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/91
@ -179,0 +183,4 @@
// do priority connections first...
for connectingCount < cr.maxTorCircuitsPending() && len(cr.priorityQueue.queue) > 0 {
contact := cr.priorityQueue.dequeue()
if contact == nil {
this shouldn't be needed, the outer loop checks len, so it should be redundant
@ -179,0 +190,4 @@
if contact.state == connections.DISCONNECTED {
cr.publishConnectionRequest(contact)
connectingCount++
break
this breaks the priority queue, it'll pull one item off it then break
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/92