mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
Review comments from #56
This commit is contained in:
parent
99b2923ce7
commit
622b7af311
|
|
@ -35,6 +35,15 @@ type RequestPool struct {
|
|||
cond *sync.Cond
|
||||
}
|
||||
|
||||
// NewRequestPool makes a new RequestPool
|
||||
func NewRequestPool(db *storage.SyncServerDatabase) (*RequestPool, error) {
|
||||
pos, err := db.SyncStreamPosition()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &RequestPool{db, syncStreamPosition(pos), sync.NewCond(&sync.Mutex{})}, nil
|
||||
}
|
||||
|
||||
// OnIncomingSyncRequest is called when a client makes a /sync request. This function MUST be
|
||||
// called in a dedicated goroutine for this request. This function will block the goroutine
|
||||
// until a response is ready, or it times out.
|
||||
|
|
@ -161,12 +170,3 @@ func getSyncStreamPosition(since string) (syncStreamPosition, error) {
|
|||
}
|
||||
return syncStreamPosition(i), nil
|
||||
}
|
||||
|
||||
// NewRequestPool makes a new RequestPool
|
||||
func NewRequestPool(db *storage.SyncServerDatabase) (*RequestPool, error) {
|
||||
pos, err := db.SyncStreamPosition()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &RequestPool{db, syncStreamPosition(pos), sync.NewCond(&sync.Mutex{})}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue