Skip to content

Commit

Permalink
Release 1.81.0.0 for synapse 1.81.0
Browse files Browse the repository at this point in the history
  • Loading branch information
julianhille committed Nov 18, 2023
1 parent b7f6c03 commit 3d2cbd6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### [1.81.0.0] - 2023-11-18

### Updated

- Synapse to 1.81.0

### [1.80.0.0] - 2023-04-03

### Updated
Expand Down Expand Up @@ -131,7 +137,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Location of github action workflow file `build.yml`
- Fix robustness for matrix-synapse name and packages changes and rebuilding in the same path (updater script)

[unreleased]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.80.0.0...HEAD
[unreleased]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.81.0.0...HEAD
[1.80.0.0]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.80.0.0...v1.81.0.0
[1.79.0.0]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.79.0.0...v1.80.0.0
[1.79.0.0]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.78.0.0...v1.79.0.0
[1.78.0.0]: https://github.com/conhealth/LifeTime-Desktop/compare/v1.77.0.0...v1.78.0.0
Expand Down
33 changes: 31 additions & 2 deletions matrix_synapse_testutils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import logging
import os
import os.path
import sqlite3
import time
import uuid
import warnings
Expand Down Expand Up @@ -79,7 +80,9 @@
from synapse.logging.context import ContextResourceUsage
from synapse.server import HomeServer
from synapse.storage import DataStore
from synapse.storage.database import LoggingDatabaseConnection
from synapse.storage.engines import PostgresEngine, create_engine
from synapse.storage.prepare_database import prepare_database
from synapse.types import ISynapseReactor, JsonDict
from synapse.util import Clock

Expand All @@ -104,6 +107,10 @@
# the type of thing that can be passed into `make_request` in the headers list
CustomHeaderType = Tuple[Union[str, bytes], Union[str, bytes]]

# A pre-prepared SQLite DB that is used as a template when creating new SQLite
# DB each test run. This dramatically speeds up test set up when using SQLite.
PREPPED_SQLITE_DB_CONN: Optional[LoggingDatabaseConnection] = None


class TimedOutException(Exception):
"""
Expand Down Expand Up @@ -899,6 +906,22 @@ def setup_test_homeserver(
"args": {"database": test_db_location, "cp_min": 1, "cp_max": 1},
}

# Check if we have set up a DB that we can use as a template.
global PREPPED_SQLITE_DB_CONN
if PREPPED_SQLITE_DB_CONN is None:
temp_engine = create_engine(database_config)
PREPPED_SQLITE_DB_CONN = LoggingDatabaseConnection(
sqlite3.connect(":memory:"), temp_engine, "PREPPED_CONN"
)

database = DatabaseConnectionConfig("master", database_config)
config.database.databases = [database]
prepare_database(
PREPPED_SQLITE_DB_CONN, create_engine(database_config), config
)

database_config["_TEST_PREPPED_CONN"] = PREPPED_SQLITE_DB_CONN

if "db_txn_limit" in kwargs:
database_config["txn_limit"] = kwargs["db_txn_limit"]

Expand Down Expand Up @@ -983,15 +1006,21 @@ def cleanup() -> None:
dropped = True
except psycopg2.OperationalError as e:
warnings.warn(
"Couldn't drop old db: " + str(e), category=UserWarning
"Couldn't drop old db: " + str(e),
category=UserWarning,
stacklevel=2,
)
time.sleep(0.5)

cur.close()
db_conn.close()

if not dropped:
warnings.warn("Failed to drop old DB.", category=UserWarning)
warnings.warn(
"Failed to drop old DB.",
category=UserWarning,
stacklevel=2,
)

if not LEAVE_DB:
# Register the cleanup hook
Expand Down
16 changes: 13 additions & 3 deletions matrix_synapse_testutils/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ def setUp(orig: Callable[[], R]) -> R:
% (current_context(),)
)

# Disable GC for duration of test. See below for why.
gc.disable()

old_level = logging.getLogger().level
if level is not None and old_level != level:

Expand All @@ -163,12 +166,19 @@ def tearDown(orig: Callable[[], R]) -> R:

return orig()

# We want to force a GC to workaround problems with deferreds leaking
# logcontexts when they are GCed (see the logcontext docs).
#
# The easiest way to do this would be to do a full GC after each test
# run, but that is very expensive. Instead, we disable GC (above) for
# the duration of the test so that we only need to run a gen-0 GC, which
# is a lot quicker.

@around(self)
def tearDown(orig: Callable[[], R]) -> R:
ret = orig()
# force a GC to workaround problems with deferreds leaking logcontexts when
# they are GCed (see the logcontext docs)
gc.collect()
gc.collect(0)
gc.enable()
set_current_context(SENTINEL_CONTEXT)

return ret
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
"Topic :: Software Development"
]
dependencies = [
"matrix-synapse[test]==1.80.0"
"matrix-synapse[test]==1.81.0"
]

[project.urls]
Expand Down

0 comments on commit 3d2cbd6

Please sign in to comment.