Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Merge mainline release v1.15.1 into dinsic #50

Merged
merged 63 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ef884f6
Convert identity handler to async/await. (#7561)
clokep May 26, 2020
9848389
Merge branch 'develop' of github.com:matrix-org/synapse into develop
babolivier May 26, 2020
0a6e837
Fix incorrect placeholder syntax in database prepartion code (#7575)
anoadragon453 May 27, 2020
5af572a
Merge tag 'v1.14.0rc2' into develop
babolivier May 27, 2020
c4a820b
allow emails to be passed through SAML (#7385)
cg505 May 27, 2020
35c3087
Speed up processing of federation stream RDATA rows.
erikjohnston May 27, 2020
a6a40a1
Newsfile
erikjohnston May 27, 2020
a72d5f3
Add test for Linearizer.is_queued(..)
erikjohnston May 27, 2020
3d7f1b5
Remove spurious change
erikjohnston May 27, 2020
ef3934e
Ensure we persist and ack the same token
erikjohnston May 27, 2020
8c5f88f
Merge pull request #7584 from matrix-org/erikj/save_and_send_fed_toke…
erikjohnston May 27, 2020
5cb470b
Merge branch 'master' into develop
babolivier May 28, 2020
47db2c3
Add entry to set dependency against psql service (#7591)
drio May 28, 2020
f5353ef
Make inflight background metrics more efficient. (#7597)
erikjohnston May 29, 2020
cb495f5
Fix 'FederationGroupsRoomsServlet' API when group has room server is …
erikjohnston May 29, 2020
91a7c5f
Update OpenBSD installation instructions (#7587)
hashashini May 30, 2020
2dc430d
Use upsert when inserting read receipts (#7607)
ilmari Jun 1, 2020
c1bdd4f
Don't fail all of an iteration of the device list retry loop on error…
babolivier Jun 1, 2020
6af9cdc
Convert groups local and server to async/await. (#7600)
clokep Jun 1, 2020
df8a3ce
Improve performance of _get_state_groups_from_groups_txn (#7567)
ilmari Jun 1, 2020
901b1fa
Email notifications for new users when creating via the Admin API. (#…
dklimpel Jun 1, 2020
33c39ab
Process cross-signing keys when resyncing device lists (#7594)
babolivier Jun 1, 2020
fe434cd
Fix a bug in automatic user creation with m.login.jwt. (#7585)
olof Jun 1, 2020
25e2d19
Advertise Python 3.8 support in setup.py (#7602)
anoadragon453 Jun 1, 2020
3e55744
Mention #synapse:matrix.org in README troubleshooting (#7603)
anoadragon453 Jun 1, 2020
816589b
update grafana dashboard
richvdh Jun 2, 2020
1bbc9e2
Clean up exception handling in SAML2ResponseResource (#7614)
richvdh Jun 3, 2020
3820c24
Merge branch 'master' into develop
richvdh Jun 3, 2020
2a8ed93
Switch back to upstream dh-virtualenv (#7621)
richvdh Jun 3, 2020
38d4ebb
`synctl restart` should start synapse if it wasn't running (#7624)
richvdh Jun 3, 2020
11dc2b4
Fix exceptions when fetching events from a down host. (#7622)
erikjohnston Jun 3, 2020
c9507be
Check if the localpart is reserved for guests earlier in the registra…
babolivier Jun 3, 2020
0188daf
Replace instances of reactor pumping with get_success. (#7619)
anoadragon453 Jun 3, 2020
86d814c
Check the changelog number in check-newsfragment (#7623)
richvdh Jun 3, 2020
e91abfd
async/await get_user_id_by_threepid (#7620)
anoadragon453 Jun 3, 2020
11de843
Cleanups to the OpenID Connect integration (#7628)
richvdh Jun 3, 2020
f8b9ead
Advertise the token login type when OpenID Connect is enabled. (#7631)
clokep Jun 4, 2020
c389bfb
Fix encryption algorithm typos in tests/comments (#7637)
anoadragon453 Jun 4, 2020
f4e6495
Performance improvements and refactor of Ratelimiter (#7595)
anoadragon453 Jun 5, 2020
e55ee7c
Add support for webp thumbnailing (#7586)
WGH- Jun 5, 2020
139bc86
Support CS API v0.6.0 (#6585)
anoadragon453 Jun 5, 2020
02f345d
Attempt to fix PhoneHomeStatsTestCase.test_performance_100 being flak…
clokep Jun 5, 2020
2970ce8
Add device management to admin API (#7481)
dklimpel Jun 5, 2020
908f9e2
Allow new users to be registered via the admin API even if the monthl…
dklimpel Jun 5, 2020
f1e61ef
Typo fixes.
clokep Jun 5, 2020
b4f8dcb
Remove some unused constants. (#7644)
richvdh Jun 5, 2020
eea1243
Fix type information on `assert_*_is_admin` methods (#7645)
richvdh Jun 5, 2020
a0d2d81
Update to the stable SSO prefix for UI Auth. (#7630)
clokep Jun 5, 2020
1bc00fd
Clarifications to the admin api documentation (#7647)
richvdh Jun 5, 2020
0909931
Add an option to disable autojoin for guest accounts (#6637)
turt2live Jun 5, 2020
737b4a9
Convert user directory handler and related classes to async/await. (#…
clokep Jun 5, 2020
375ca0c
Accept device information at the login fallback endpoint. (#7629)
clokep Jun 8, 2020
3c45a78
Convert the registration handler to async/await. (#7649)
clokep Jun 8, 2020
664409b
Fix bug in account data replication stream. (#7656)
erikjohnston Jun 9, 2020
8587b04
1.15.0rc1
babolivier Jun 9, 2020
2dc9468
Revert "1.15.0rc1"
babolivier Jun 9, 2020
236d2d6
1.15.0rc1
babolivier Jun 9, 2020
3e8c854
Update CHANGES.md
richvdh Jun 9, 2020
737530a
Fix some attributions
babolivier Jun 9, 2020
1cd6779
Merge branch 'release-v1.15.0' of github.com:matrix-org/synapse into …
babolivier Jun 9, 2020
3b3f327
1.15.0
babolivier Jun 11, 2020
a7d49db
Merge branch 'release-v1.15.0' of github.com:matrix-org/synapse into …
anoadragon453 Jun 24, 2020
b213313
Changelog
anoadragon453 Jun 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
async/await get_user_id_by_threepid (#7620)
Based on #7619 

async's `get_user_id_by_threepid` and its call stack.
  • Loading branch information
anoadragon453 authored Jun 3, 2020
commit e91abfd2919bcd42322099ecca8387a2dae9b06e
1 change: 1 addition & 0 deletions changelog.d/7620.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert `get_user_id_by_threepid` to async/await.
9 changes: 4 additions & 5 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,18 +617,17 @@ def reap_monthly_active_users():
clock.looping_call(reap_monthly_active_users, 1000 * 60 * 60)
reap_monthly_active_users()

@defer.inlineCallbacks
def generate_monthly_active_users():
async def generate_monthly_active_users():
current_mau_count = 0
current_mau_count_by_service = {}
reserved_users = ()
store = hs.get_datastore()
if hs.config.limit_usage_by_mau or hs.config.mau_stats_only:
current_mau_count = yield store.get_monthly_active_count()
current_mau_count = await store.get_monthly_active_count()
current_mau_count_by_service = (
yield store.get_monthly_active_count_by_service()
await store.get_monthly_active_count_by_service()
)
reserved_users = yield store.get_registered_reserved_users()
reserved_users = await store.get_registered_reserved_users()
current_mau_gauge.set(float(current_mau_count))

for app_service, count in current_mau_count_by_service.items():
Expand Down
25 changes: 12 additions & 13 deletions synapse/storage/data_stores/main/monthly_active_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import List

from twisted.internet import defer

Expand Down Expand Up @@ -77,20 +78,19 @@ def _count_users_by_service(txn):

return self.db.runInteraction("count_users_by_service", _count_users_by_service)

@defer.inlineCallbacks
def get_registered_reserved_users(self):
"""Of the reserved threepids defined in config, which are associated
with registered users?
async def get_registered_reserved_users(self) -> List[str]:
"""Of the reserved threepids defined in config, retrieve those that are associated
with registered users

Returns:
Defered[list]: Real reserved users
User IDs of actual users that are reserved
"""
users = []

for tp in self.hs.config.mau_limits_reserved_threepids[
: self.hs.config.max_mau_value
]:
user_id = yield self.hs.get_datastore().get_user_id_by_threepid(
user_id = await self.hs.get_datastore().get_user_id_by_threepid(
tp["medium"], tp["address"]
)
if user_id:
Expand Down Expand Up @@ -171,13 +171,9 @@ def _initialise_reserved_users(self, txn, threepids):
else:
logger.warning("mau limit reserved threepid %s not found in db" % tp)

@defer.inlineCallbacks
def reap_monthly_active_users(self):
async def reap_monthly_active_users(self):
"""Cleans out monthly active user table to ensure that no stale
entries exist.

Returns:
Deferred[]
"""

def _reap_users(txn, reserved_users):
Expand Down Expand Up @@ -249,8 +245,8 @@ def _reap_users(txn, reserved_users):
)
self._invalidate_cache_and_stream(txn, self.get_monthly_active_count, ())

reserved_users = yield self.get_registered_reserved_users()
yield self.db.runInteraction(
reserved_users = await self.get_registered_reserved_users()
await self.db.runInteraction(
"reap_monthly_active_users", _reap_users, reserved_users
)

Expand All @@ -261,6 +257,9 @@ def upsert_monthly_active_user(self, user_id):

Args:
user_id (str): user to add/update

Returns:
Deferred
"""
# Support user never to be included in MAU stats. Note I can't easily call this
# from upsert_monthly_active_user_txn because then I need a _txn form of
Expand Down
22 changes: 12 additions & 10 deletions synapse/storage/data_stores/main/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import logging
import re
from typing import Optional

from six import iterkeys

Expand Down Expand Up @@ -342,7 +343,7 @@ def is_real_user(self, user_id):
)
return res

@cachedInlineCallbacks()
@cached()
def is_support_user(self, user_id):
"""Determines if the user is of type UserTypes.SUPPORT

Expand All @@ -352,10 +353,9 @@ def is_support_user(self, user_id):
Returns:
Deferred[bool]: True if user is of type UserTypes.SUPPORT
"""
res = yield self.db.runInteraction(
return self.db.runInteraction(
"is_support_user", self.is_support_user_txn, user_id
)
return res

def is_real_user_txn(self, txn, user_id):
res = self.db.simple_select_one_onecol_txn(
Expand Down Expand Up @@ -516,18 +516,17 @@ def _find_next_generated_user_id(txn):
)
)

@defer.inlineCallbacks
def get_user_id_by_threepid(self, medium, address):
async def get_user_id_by_threepid(self, medium: str, address: str) -> Optional[str]:
"""Returns user id from threepid

Args:
medium (str): threepid medium e.g. email
address (str): threepid address e.g. me@example.com
medium: threepid medium e.g. email
address: threepid address e.g. me@example.com

Returns:
Deferred[str|None]: user id or None if no user id/threepid mapping exists
The user ID or None if no user id/threepid mapping exists
"""
user_id = yield self.db.runInteraction(
user_id = await self.db.runInteraction(
"get_user_id_by_threepid", self.get_user_id_by_threepid_txn, medium, address
)
return user_id
Expand Down Expand Up @@ -993,7 +992,7 @@ def register_user(

Args:
user_id (str): The desired user ID to register.
password_hash (str): Optional. The password hash for this user.
password_hash (str|None): Optional. The password hash for this user.
was_guest (bool): Optional. Whether this is a guest account being
upgraded to a non-guest account.
make_guest (boolean): True if the the new user should be guest,
Expand All @@ -1007,6 +1006,9 @@ def register_user(

Raises:
StoreError if the user_id could not be registered.

Returns:
Deferred
"""
return self.db.runInteraction(
"register_user",
Expand Down