apple / ccs-twistedextensions

Extensions to Twisted used by CalendarServer
https://www.calendarserver.org
Apache License 2.0
17 stars 29 forks source link

add an explicit threadpool argument to ConnectionPool initializer #7

Open macosforgebot opened 10 years ago

macosforgebot commented 10 years ago

exarkun@… originally submitted this as ticket:835


ConnectionPool has a reactor (class) attribute that initializes to the global reactor. It uses this for IReactorThreads (to thread the actual SQL execution) and IReactorTime (to schedule reconnection attempts).

This makes it possible to fake things out for unit testing purposes, but not super convenient. Twisted itself doesn't include a good fake of IReactorThreads.

It seems ConnectionPool.__init__ could accept an (optional) ThreadPool instance to use instead of the IReactorThreads implementation of ConnectionPool.reactor.

macosforgebot commented 10 years ago

@wsanchez originally submitted this as comment:1:⁠ticket:835