Commit graph

500 commits

Author SHA1 Message Date
Erik Johnston
ddf7979531 Add receipts_key to StreamToken 2015-07-02 11:45:44 +01:00
Kegan Dougal
d88e20cdb9 Fix bug where synapse was sending AS user queries incorrectly.
Bug introduced in 92b20713d7
which reversed the comparison when checking if a user existed
in the users table. Added UTs to prevent this happening again.
2015-06-17 17:26:03 +01:00
Erik Johnston
261ccd7f5f Fix tests 2015-06-12 17:17:29 +01:00
Erik Johnston
3bbd0d0e09 Merge pull request #180 from matrix-org/erikj/prev_state_context
Don't needlessly compute prev_state
2015-06-03 17:20:56 +01:00
Erik Johnston
9dda396baa Merge pull request #179 from matrix-org/erikj/state_group_outliers
Don't compute EventContext for outliers.
2015-06-03 17:20:40 +01:00
Erik Johnston
55bf90b9e4 Don't needlessly compute prev_state 2015-06-03 16:44:24 +01:00
Erik Johnston
1c3d844e73 Don't needlessly compute context 2015-06-03 16:41:51 +01:00
Erik Johnston
d8866d7277 Caches should be bound to instances.
Before, caches were global and so different instances of the stores
would share caches. This caused problems in the unit tests.
2015-06-03 14:45:17 +01:00
Mark Haines
17167898c8 Fix the presence tests 2015-05-22 16:22:54 +01:00
Mark Haines
49a2c10279 Merge pull request #157 from matrix-org/markjh/presence_performance
Improve presence performance in loadtest
2015-05-22 16:04:40 +01:00
Mark Haines
f43544eecc Make the appservice use 'users_in_room' rather than get_room_members since it is cached 2015-05-22 11:01:28 +01:00
Mark Haines
88f1ea36ce Oops, get_rooms_for_user returns a namedtuple, not a room_id 2015-05-21 15:23:58 +01:00
Erik Johnston
a551c5dad7 Merge pull request #155 from matrix-org/erikj/perf
Bulk and batch retrieval of events.
2015-05-21 14:54:40 +01:00
Mark Haines
8eca5bd50a Fix the presence tests 2015-05-20 13:22:18 +01:00
Mark Haines
0b0033c40b Merge branch 'develop' into notifier_performance 2015-05-18 13:50:01 +01:00
Erik Johnston
131bdf9bb1 Merge branch 'erikj/events_move' of github.com:matrix-org/synapse into erikj/perf 2015-05-18 10:23:37 +01:00
Erik Johnston
a2c4f3f150 Fix daedlock 2015-05-15 10:54:04 +01:00
Mark Haines
c5d1b4986b Remove unused arguments and doc PresenceHandler.push_update_to_clients 2015-05-14 14:59:31 +01:00
Mark Haines
f1b83d88a3 Discard unused NotifierUserStreams 2015-05-13 16:54:02 +01:00
Mark Haines
63878c0379 Don't bother checking for updates if the stream token hasn't advanced for a user 2015-05-13 13:42:21 +01:00
Erik Johnston
43c2e8deae Add support for using executemany 2015-05-05 15:13:25 +01:00
Erik Johnston
327ca883ec Merge branch 'develop' of github.com:matrix-org/synapse into postgres 2015-04-28 13:39:42 +01:00
Erik Johnston
6f8e2d517e Merge branch 'develop' of github.com:matrix-org/synapse into postgres 2015-04-27 14:41:40 +01:00
David Baker
6532b6e607 Merge branch 'develop' into csauth
Conflicts:
	synapse/http/server.py
2015-04-24 09:37:54 +01:00
Paul "LeoNerd" Evans
e1e5e53127 Remove users from the remote_offline_serials list (and clean up empty elements) when they go online again 2015-04-23 19:01:37 +01:00
Paul "LeoNerd" Evans
8a785c3006 Store a list of the presence serial number at which remote users went offline, so that when we delete them from the cachemap, we can still synthesize OFFLINE events for them (SYN-261) 2015-04-23 18:40:19 +01:00
David Baker
cb03fafdf1 Merge branch 'develop' into csauth 2015-04-17 13:51:10 +01:00
Erik Johnston
6ba2e3df4e Merge branch 'develop' of github.com:matrix-org/synapse into postgres 2015-04-17 11:22:31 +01:00
Paul "LeoNerd" Evans
04c7f3576e Various minor fixes to unit-test structure around typing notifications 2015-04-15 23:32:11 +01:00
Paul "LeoNerd" Evans
0268d40281 Have TypingNotificationEventSource.get_new_events_for_user() return a deferred, for consistency and extensibility 2015-04-15 23:09:35 +01:00
Erik Johnston
22d7a59306 Fix tests after commit 9a0579 2015-04-08 16:57:14 +01:00
Erik Johnston
4fe95094d1 Merge branch 'develop' of github.com:matrix-org/synapse into mysql 2015-04-07 18:05:39 +01:00
Erik Johnston
9236136f3a Make work in both Maria and SQLite. Fix tests 2015-04-01 14:12:33 +01:00
Kegan Dougal
9fa8bda099 Merge branch 'develop' into application-services-registration-script 2015-04-01 10:19:17 +01:00
Kegan Dougal
09cbff174a Fix thinko whereby events *for the AS specifically* were not passed on.
This was caused by not explicitly checking the service.sender field. This
has now been fixed and a regression test has been added.
2015-03-31 16:44:45 +01:00
Kegan Dougal
cf1fa59f4b Use a sender localpart instead of a user ID.
Form the user ID at runtime instead, This gives less room for error in AS
config files since they cannot specify the domain of another HS.
2015-03-31 13:48:03 +01:00
Kegan Dougal
c217504949 Edit SQL schema to use string IDs not ints. Use token as ID. Update tests. 2015-03-31 12:07:56 +01:00
Kegan Dougal
b59aa74556 Fix tests and missing returns on deferreds. 2015-03-31 11:35:45 +01:00
Kegan Dougal
d33ae65efc Remove more reg/unreg methods. Read config not database for cache. 2015-03-31 11:00:00 +01:00
Kegan Dougal
4edcbcee3b Merge branch 'develop' into application-services-txn-reliability
Conflicts:
	synapse/storage/__init__.py
2015-03-26 10:07:59 +00:00
Paul "LeoNerd" Evans
9ba6487b3f Allow a choice of LRU behaviour for Cache() by using LruCache() or OrderedDict() 2015-03-25 19:05:34 +00:00
Paul "LeoNerd" Evans
7ab9f91a60 Unit-test that Cache() key eviction is ordered 2015-03-25 18:50:43 +00:00
David Baker
ce2766d19c Fix tests 2015-03-24 18:56:51 +00:00
David Baker
438a21c87b Don't test exact equality of the list: as long as it has the fields we expect, that's just fine. I added the user_id (as in database pkey) and it broke: no point testing what that comes out as: it's determined by the db. 2015-03-24 18:21:54 +00:00
Paul "LeoNerd" Evans
0f86312c4c Pull out the cache logic from the @cached wrapper into its own class we can reuse 2015-03-20 18:25:42 +00:00
Erik Johnston
7e282a53a5 Tidy up _simple_... methods 2015-03-20 15:05:10 +00:00
Kegan Dougal
d04fa1f712 Implement ServiceQueuer with tests. 2015-03-16 14:03:16 +00:00
Kegan Dougal
6279285b2a Replace EventGrouper for ServiceQueuer to move to push-based txns. Fix tests and add stub tests for ServiceQueuer. 2015-03-16 13:15:40 +00:00
Kegan Dougal
835e01fc70 Minor PR comment tweaks. 2015-03-16 10:16:59 +00:00
Kegan Dougal
f9232c7917 Merge branch 'develop' into application-services-txn-reliability
Conflicts:
	synapse/storage/appservice.py
2015-03-16 10:09:15 +00:00
Paul "LeoNerd" Evans
c1cdd7954d Add an .inc_by() method to CounterMetric; implement DistributionMetric a neater way 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
f1fbe3e09f Rename TimerMetric to DistributionMetric; as it could count more than just time 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
cbc0406be8 Export CacheMetric as hits+total, rather than hits+misses, as it's easier to derive hit ratio from that 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
0e847540c3 Prometheus needs "escaped" label values 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
b3a0179d64 Bugfix to rendering output of vectored TimerMetrics 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
f9478e475b Rename Metrics' "keys" to "labels" 2015-03-12 16:24:51 +00:00
Paul "LeoNerd" Evans
72625f2f4d Initial hack at a TimerMetric; for storing counts + duration accumulators 2015-03-12 16:24:50 +00:00
Paul "LeoNerd" Evans
23ab0c68c2 Implement vector CallbackMetrics 2015-03-12 16:24:50 +00:00
Paul "LeoNerd" Evans
8664599af7 Rename CacheCounterMetric to just CacheMetric; add a CallbackMetric component to give the size of the cache 2015-03-12 16:24:50 +00:00
Paul "LeoNerd" Evans
d8caa5454d Initial attempt at a scalar callback-based metric to give instantaneous snapshot gauges 2015-03-12 16:24:50 +00:00
Paul "LeoNerd" Evans
ce8b5769f7 Create the concept of a cachecounter metric; generating two counters specific to caches 2015-03-12 16:24:50 +00:00
Paul "LeoNerd" Evans
e7420a3bef Initial tiny attempt at (vectorable) counter metrics 2015-03-12 16:24:50 +00:00
Kegan Dougal
b98cd03193 Use event IDs instead of dumping event content in the txns table. 2015-03-09 17:25:20 +00:00
Kegan Dougal
21fd84dcb8 Use seconds; start gluing in the AS scheduler into the AS handler. 2015-03-09 17:01:19 +00:00
Erik Johnston
6d74e46621 Fix tests 2015-03-09 17:01:11 +00:00
Kegan Dougal
0a60bbf4fa Finish appservice txn storage impl and tests. 2015-03-09 15:53:03 +00:00
Kegan Dougal
1ead1caa18 Implement create_appservice_txn with tests. 2015-03-09 13:54:20 +00:00
Kegan Dougal
1c2dcf762a Partially implement txn store methods with tests. 2015-03-09 13:10:31 +00:00
Kegan Dougal
10766f1e93 Update UTs 2015-03-06 16:17:01 +00:00
Kegan Dougal
2602ddc379 Apply clarity and docstrings 2015-03-06 16:16:14 +00:00
Kegan Dougal
0354659f9d Finish synapse.appservice.scheduler implementation.
With tests to assert behaviour. Not hooked up yet. Stub datastore methods
not implemented yet.
2015-03-06 16:09:05 +00:00
Kegan Dougal
f260cb72cd Flesh out more stub functions. 2015-03-06 15:12:24 +00:00
Kegan Dougal
0fbfe1b08a Add more tests; fix bugs. 2015-03-06 14:36:52 +00:00
Kegan Dougal
192e228a98 Start adding some tests 2015-03-06 11:50:27 +00:00
Kegsay
8ad024ea80 Merge pull request #93 from matrix-org/application-services-exclusive
Application services exclusive flag support
2015-03-02 14:56:32 +00:00
Erik Johnston
0a036944bd Merge branch 'develop' of github.com:matrix-org/synapse into batched_get_pdu 2015-03-02 13:53:30 +00:00
Kegan Dougal
de190e49d5 Add more unit tests for exclusive namespaces. 2015-02-27 11:51:06 +00:00
Kegan Dougal
127efeeb68 Update unit tests to use new format. 2015-02-27 11:10:48 +00:00
Kegan Dougal
0ebd632d39 Fix unit tests 2015-02-27 09:46:38 +00:00
Paul "LeoNerd" Evans
f53fcbce97 Use cache.pop() instead of a separate membership test + del [] 2015-02-23 18:30:45 +00:00
Paul "LeoNerd" Evans
bd84755e64 Merge remote-tracking branch 'origin/develop' into performance-cache-improvements 2015-02-23 17:16:03 +00:00
Paul "LeoNerd" Evans
e76d485e29 Allow @cached-wrapped functions to have a prefill method for setting entries 2015-02-23 15:41:54 +00:00
Erik Johnston
852816befe Fix presence tests 2015-02-23 15:14:09 +00:00
Paul "LeoNerd" Evans
ebc3db295b Take named arguments to @cached() decorator, add a 'max_entries' limit 2015-02-19 18:36:02 +00:00
Erik Johnston
5f4c28d313 Update tests 2015-02-19 14:34:32 +00:00
Erik Johnston
5358966a87 Use git aware version string in User-Agent and Server headers 2015-02-18 16:52:04 +00:00
Mark Haines
0d872f5aa6 Merge pull request #50 from matrix-org/application-services
Application Services
2015-02-13 15:06:14 +00:00
Erik Johnston
021d93db11 Merge pull request #62 from matrix-org/state-chache
State chache
2015-02-11 17:10:28 +00:00
Kegan Dougal
cb43fbeeb4 Fix tests which broke when event caching was introduced. 2015-02-11 16:46:01 +00:00
Kegan Dougal
f2fdcb7c4b Merge branch 'develop' into application-services 2015-02-11 16:43:26 +00:00
Mark Haines
f5a70e0d2e Add a cache for get_event 2015-02-11 15:01:15 +00:00
Mark Haines
d8324d5a2b Add a lru cache class 2015-02-11 14:52:23 +00:00
Mark Haines
896253e085 Factor out some of the common homeserver setup code into a
setup_test_homeserver function in utils.
2015-02-11 11:37:30 +00:00
Kegan Dougal
c7783d6fee Notify ASes for events sent by other users in a room which an AS user is a part of. 2015-02-11 10:36:08 +00:00
Erik Johnston
164f6b9256 Fix tests 2015-02-09 14:23:57 +00:00
Kegan Dougal
ab3c897ce1 Remove unused imports. 2015-02-09 14:16:36 +00:00
Kegan Dougal
5a7dd05818 Modify auth.get_user_by_req for authing appservices directly.
Add logic to map the appservice token to the autogenned appservice user ID.
Add unit tests for all forms of get_user_by_req (user/appservice,
valid/bad/missing tokens)
2015-02-09 14:14:15 +00:00
Kegan Dougal
11e6b3d18b Dependency inject ApplicationServiceApi when creating ApplicationServicesHandler. 2015-02-05 17:04:59 +00:00
Kegan Dougal
951690e54d Merge branch 'develop' into application-services 2015-02-05 14:28:03 +00:00
Kegan Dougal
131e036402 Fix unit tests. 2015-02-05 13:22:20 +00:00
Kegan Dougal
bc658907f0 Add unit test for appservice_handler.query_room_alias_exists 2015-02-05 11:54:36 +00:00
Kegan Dougal
f0c730252f Add unknown user ID check. Use store.get_aliases_for_room(room_id) when searching for services by alias. 2015-02-05 11:25:32 +00:00
Kegan Dougal
27091f146a Add hs_token column and generate a different token f.e application service. 2015-02-05 10:08:12 +00:00
Kegan Dougal
89f2e8fbdf Fix bug in store defer. Add more unit tests. 2015-02-04 15:21:03 +00:00
Kegan Dougal
525a218b2b Begin to add unit tests for appservice glue and regex testing. 2015-02-04 12:24:20 +00:00
Erik Johnston
e7ca813dd4 Try to ensure we don't persist an event we have already persisted. In persist_event check if we already have the event, if so then update instead of replacing so that we don't cause a bump of the stream_ordering. 2015-02-03 10:39:41 +00:00
Erik Johnston
1bd540ef79 Merge branch 'develop' of github.com:matrix-org/synapse into rejections
Conflicts:
	synapse/storage/schema/im.sql
2015-01-30 15:16:38 +00:00
Erik Johnston
471c47441d Merge pull request #37 from matrix-org/client_v2_filter
Client v2 filter
2015-01-30 14:56:08 +00:00
Erik Johnston
2aaedab203 Merge branch 'develop' of github.com:matrix-org/synapse into new_state_resolution 2015-01-30 14:09:32 +00:00
Erik Johnston
2ebf795c0a Merge branch 'develop' of github.com:matrix-org/synapse into rejections
Conflicts:
	synapse/storage/__init__.py
	synapse/storage/schema/delta/v12.sql
2015-01-30 11:10:37 +00:00
Mark Haines
93ed31dda2 Create a separate filter object to do the actual filtering, so that we can
split the storage and management of filters from the actual filter code
and don't have to load a filter from the db each time we filter an event
2015-01-29 17:45:07 +00:00
Erik Johnston
78015948a7 Initial implementation of auth conflict resolution 2015-01-29 16:52:33 +00:00
Mark Haines
33391db5f8 Merge in auth changes from develop 2015-01-29 15:54:54 +00:00
Mark Haines
9d8f798a3f Merge changes from develop 2015-01-29 14:55:27 +00:00
Kegan Dougal
38b27bd2cb Add filter_room_state unit tests. 2015-01-29 14:28:34 +00:00
Kegan Dougal
83172487b0 Add basic filtering public API unit tests. Use defers in the right places. 2015-01-29 12:20:59 +00:00
Kegan Dougal
5561a87920 Add more unit tests for the filter algorithm. 2015-01-29 12:06:16 +00:00
Kegan Dougal
777d9914b5 Implement filter algorithm. Add basic event type unit tests to assert it works. 2015-01-29 11:38:06 +00:00
Mark Haines
26c8fff19e Merge pull request #36 from matrix-org/device_id_from_access_token
Extract the device id and token id from the access token when autheniticating users
2015-01-28 17:19:28 +00:00
Mark Haines
388581e087 Extract the id token of the token when authing users, include the token and device_id in the internal meta data for the event along with the transaction id when sending events 2015-01-28 16:58:23 +00:00
Kegan Dougal
c23e3db544 Add filter JSON sanity checks. 2015-01-28 16:45:18 +00:00
Mark Haines
c59bcabf0b Return the device_id from get_auth_by_req 2015-01-28 15:43:41 +00:00
Paul "LeoNerd" Evans
06cc147012 Initial stab at real SQL storage implementation of user filter definitions 2015-01-27 18:46:03 +00:00
Paul "LeoNerd" Evans
0c14a699bb More unit-testing of REST errors 2015-01-27 18:07:21 +00:00
Paul "LeoNerd" Evans
54e513b4e6 Move storage of user filters into real datastore layer; now have to mock it out in the REST-level tests 2015-01-27 17:48:13 +00:00
Paul "LeoNerd" Evans
059651efa1 Have the Filtering API return Deferreds, so we can do the Datastore implementation nicely 2015-01-27 16:17:56 +00:00
Paul "LeoNerd" Evans
b1503112ce Initial trivial unittest of Filtering object 2015-01-27 15:56:14 +00:00
Paul "LeoNerd" Evans
f9958f3404 Use new V2AlphaRestTestCase 2015-01-27 13:17:25 +00:00
Paul "LeoNerd" Evans
0484d7f6e9 Merge branch 'develop' into client_v2_filter 2015-01-27 13:11:03 +00:00
Paul "LeoNerd" Evans
57d2bfca3f Initial cut of a shared base class for REST unit tests 2015-01-27 13:09:57 +00:00
Paul "LeoNerd" Evans
39c1892b22 Minor changes to v2_alpha filter REST test to allow the setUp method to be shareable 2015-01-27 13:03:31 +00:00
Paul "LeoNerd" Evans
37b8a71f10 Initial trivial REST test of v2_alpha filter API 2015-01-26 15:27:40 +00:00
Paul "LeoNerd" Evans
d07dfe5392 Create (empty) v2_alpha REST tests directory 2015-01-26 14:32:17 +00:00
Erik Johnston
9b1e552b51 Merge branch 'develop' of github.com:matrix-org/synapse into rejections 2015-01-23 15:51:48 +00:00
Mark Haines
ada711504e Replace hs.parse_roomalias with RoomAlias.from_string 2015-01-23 13:21:58 +00:00
Mark Haines
1c06c48ce2 Replace hs.parse_roomid with RoomID.from_string 2015-01-23 11:55:12 +00:00
Mark Haines
5759bec43c Replace hs.parse_userid with UserID.from_string 2015-01-23 11:47:15 +00:00
Mark Haines
7dfd99f163 Merge pull request #31 from matrix-org/client_api_resource
Merge rest servlets into the client json resource object
2015-01-23 10:55:18 +00:00
Mark Haines
7256def8e4 Merge rest servlets into the client json resource object 2015-01-23 10:37:38 +00:00
Paul "LeoNerd" Evans
3a243c53f4 Rename MockedDatastoreTestCase to MockedDatastorePresenceTestCase since it is still presence-specific 2015-01-22 20:06:28 +00:00
Paul "LeoNerd" Evans
cbb10879cb Much merging of test case setUp() methods to make them much more
shareable
2015-01-22 20:06:28 +00:00
Mark Haines
53584420a5 Move client rest tests back under rest 2015-01-22 16:13:27 +00:00
Mark Haines
97c68c508d Move rest APIs back under the rest directory 2015-01-22 16:10:07 +00:00
Mark Haines
1d2016b4a8 Move client v1 api rest servlets into a "client/v1" directory 2015-01-22 14:59:08 +00:00
Mark Haines
16bfabb9c5 Fix manifest. Ignore contrib and docs directories when checking manifest against source control. 2015-01-22 14:32:51 +00:00
Paul "LeoNerd" Evans
73315ce9de Abstract out the room ID from presence tests, so it's stored in self 2015-01-21 20:01:57 +00:00
Paul "LeoNerd" Evans
dbe71e670c Use common base class for two Presence unit-tests, avoiding boilerplate copypasta 2015-01-21 16:58:16 +00:00
Erik Johnston
6dcade97be Implement new state resolution algorithm 2015-01-21 16:27:04 +00:00
Mark Haines
5fed042640 Finish renaming "context" to "room_id" in federation codebase 2015-01-16 19:01:03 +00:00
Paul "LeoNerd" Evans
cf7e723808 Have MockClock detect attempts to cancel expired timers, to prevent a repeat of SYN-230 2015-01-13 16:58:36 +00:00