Skip to content

Commit d41add8

Browse files
Performance optimizations, CLI commands, changelog (#174)
* Cache some properties in config * Faster * Typo * Drop expensive check * Event faster configs, add --hashes flag * Slightly faster parsing of storage * typing_extensions are expensive! * less logs 🌚 * Lint * Pretty prints in new CLI commands * cli commands, fix piping, update changelog * Changelog, small fixes * changelog * Lint * force_single_line >:3
1 parent f8907cf commit d41add8

File tree

80 files changed

+947
-595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+947
-595
lines changed

CHANGELOG.md

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,67 @@
11
# Changelog
22

3-
## 4.0.0 - [unreleased]
3+
Please use [this](https://docs.gitlab.com/ee/development/changelog.html) document as guidelines to keep a changelog.
44

5-
### Fixed
5+
## 4.0.0-rc1 - [unreleased]
66

7-
* tzkt: Realtime connection watchdog is no longer triggered after TzKT outtage.
8-
* tzkt: Adding many indexes in runtime no longer leads to sending useless subscription requests.
9-
* tzkt: Fixed `get_originated_contracts` and `get_similar_contracts` methods whose output was limited to `batch_size` tunable.
10-
* index: Fixed head index callback invocation.
11-
* coinbase: Candles caching disabled.
7+
### ⚠ Migration
128

13-
### Changed
9+
* Run `dipdup schema approve --hashes` command on every database you want to use with 4.0.0-rc1.
10+
11+
### Added
12+
13+
* cli: Added `dipdup run --skip-hasura` flag to skip updating Hasura metadata.
14+
* cli: Added `dipdip run --early-realtime` flag to establish a realtime connection before all indexes are synchronized.
15+
* cli: Added`dipdup run --merge-subscriptions` flag to subscribe to all operations/big map diffs during realtime indexing. This flag helps to avoid reaching TzKT subscriptions limit (currently 10000 channels).
16+
* cli: Added `dipdup status` command to print the current status of indexes from database
17+
* cli: Added `dipdup config export [--unsafe]` command to print config after resolving all links and variables. Add `--unsafe` option to substitute environment variables.
18+
* cli: Added `dipdup cache show` command to get information about file caches used by DipDup.
19+
* cli: Added `dipdup schema approve --hashes` flag to recalculate schema and index config hashes on the next run.
20+
* config: Added `first_level` and `last_level` optional fields to `TemplateIndexConfig`. These limits are applied after ones from the template itself.
21+
* config: Added `daemon` boolean field to `JobConfig` to run a single callback indefinitely. Conflicts with `crontab` and `interval` fields.
22+
* config: Added `advanced` top-level section with following fields:
23+
24+
```yaml
25+
advanced:
26+
early_realtime: False
27+
merge_subscriptions: False
28+
oneshot: False
29+
postpone_jobs: False
30+
reindex:
31+
manual: exception
32+
migration: wipe
33+
rollback: ignore
34+
config_modified: exception
35+
schema_modified: wipe
36+
skip_hasura: False
37+
```
38+
39+
`ReindexingRequiredError` exception raised by default when reindexing is triggered. CLI flags have priority over self-titled `AdvancedConfig` fields.
1440

15-
* cli: `run --oneshot` option is deprecated and will be removed in the next major release. Oneshot mode applied automatically when `first_level` and `last_level` fields are set in index config.
41+
### Fixed
42+
43+
* cli: Fixed crashes and output inconsistency when piping DipDup commands.
1644
* codegen: Fixed missing imports in handlers generated during init.
45+
* coinbase: Fixed possible data inconsistency caused by caching enabled for method `get_candles`.
46+
* http: Fixed increasing sleep time between failed request attempts.
47+
* index: Fixed invocation of head index callback.
48+
* index: Fixed `CallbackError` raised instead of `ReindexingRequiredError` in some cases.
49+
* tzkt: Fixed resubscribing when realtime connectivity is lost for a long time.
50+
* tzkt: Fixed sending useless subscription requests when adding indexes in runtime.
51+
* tzkt: Fixed `get_originated_contracts` and `get_similar_contracts` methods whose output was limited to `HTTPConfig.batch_size` field.
52+
* tzkt: Fixed lots of SignalR bugs by replacing `aiosignalrcore` library with `pysignalr`.
1753

18-
### Added
54+
### Deprecated
1955

20-
* cli: New flag `dipdip run --early-realtime` to establish a real-time connection before all indexes are synchronized.
21-
* cli: New flag `dipdup run --skip-hasura` to skip updating Hasura metadata.
22-
* cli: New command `dipdup status` to print the current status of indexes from database
23-
* cli: New command `dipdup config` to print config after resolving all links and variables
24-
* config: Added optional fields `first_level` and `last_level` to `TemplateIndexConfig`. These limits are applied after ones from the template itself.
56+
* cli: `run --oneshot` option is deprecated and will be removed in the next major release. The oneshot mode applies automatically when `last_level` field is set in the index config.
57+
* cli: `clear-cache` command is deprecated and will be removed in the next major release. Use `cache clear` command instead.
2558

26-
### Improved
59+
### Performance
2760

28-
* index: Time required to initialize indexes presented in database reduced by ~25%.
29-
* tzkt: Replaced `aiosignalrcore` library with `pysignalr`.
61+
* config: Configuration files are loaded 10x times faster.
62+
* index: Number of operations processed by matcher reduced by 40%-95% depending on number of addresses and entrypoints used.
63+
* tzkt: Rate limit was increased. Try to set `connection_timeout` to a higher value if requests fail with `ConnectionTimeout` exception.
64+
* tzkt: Improved performance of response deserialization.
3065

3166
## 3.1.3 - 2021-11-15
3267

@@ -45,7 +80,7 @@
4580

4681
### Fixed
4782

48-
* Fixed loss of real-time subscriptions occurred after TzKT API outage.
83+
* Fixed loss of realtime subscriptions occurred after TzKT API outage.
4984
* Fixed updating schema hash in `schema approve` command.
5085
* Fixed possible crash occurred while Hasura is not ready.
5186

@@ -86,7 +121,7 @@
86121

87122
* Fixed unexpected reindexing caused by the bug in processing zero- and single-level rollbacks.
88123
* Removed unnecessary file IO calls that could cause `PermissionError` exception in Docker environments.
89-
* Fixed possible violation of block-level atomicity during real-time indexing.
124+
* Fixed possible violation of block-level atomicity during realtime indexing.
90125

91126
### Changes
92127

poetry.lock

Lines changed: 54 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pytest-cov = "^3.0.0"
5555
testcontainers = "^3.4.1"
5656
types-pytz = "^2021.1.2"
5757
types-tabulate = "^0.8.2"
58+
pprofile = "^2.1.0"
5859

5960
[tool.poetry.extras]
6061
pytezos = ["pytezos"]
@@ -64,6 +65,7 @@ dipdup = 'dipdup.cli:cli'
6465

6566
[tool.isort]
6667
line_length = 140
68+
force_single_line = true
6769

6870
[tool.black]
6971
line-length = 140

src/demo_hic_et_nunc/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from enum import IntEnum
22

3-
from tortoise import Model, fields
3+
from tortoise import Model
4+
from tortoise import fields
45

56

67
class SwapStatus(IntEnum):

src/demo_hic_et_nunc/types/hen_minter/parameter/collect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
from __future__ import annotations
55

6-
from pydantic import BaseModel, Extra
6+
from pydantic import BaseModel
7+
from pydantic import Extra
78

89

910
class CollectParameter(BaseModel):

src/demo_hic_et_nunc/types/hen_minter/parameter/mint_objkt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
from __future__ import annotations
55

6-
from pydantic import BaseModel, Extra
6+
from pydantic import BaseModel
7+
from pydantic import Extra
78

89

910
class MintOBJKTParameter(BaseModel):

0 commit comments

Comments
 (0)