Skip to content

Allow to disable GC within documents using env variable/CLI#422

Merged
paulgb merged 1 commit into
jamsocket:mainfrom
krassowski:allow-to-skip-gc
Dec 4, 2025
Merged

Allow to disable GC within documents using env variable/CLI#422
paulgb merged 1 commit into
jamsocket:mainfrom
krassowski:allow-to-skip-gc

Conversation

@krassowski

Copy link
Copy Markdown
Contributor

References

Description

Adds an option to disable GC within documents (distinct from GC of documents in multi-document mode) via:

  • CLI by passing --skip-gc to either of y-sweet serve or y-sweet serve-doc
  • Y_SWEET_SKIP_GC environment variable

I was not sure if I should also add the environment variable to y-sweet-worker for feature parity but given that it is deprecated I went for a smaller changeset and only added it in the server.

I wonder if the configuration for toggling GC of documents themselves (the doc_gc option which is not exposed by clap) would be advisable, but I think it is already possible to configure checkpoint_freq_seconds instead which can be set to a very high value that is probably better than turning it off altogether.

@paulgb paulgb merged commit 4f1909b into jamsocket:main Dec 4, 2025
5 checks passed
abyssparanoia added a commit to arcterus-jp/y-sweet that referenced this pull request Feb 4, 2026
* derive Deserialize for ClientToken (jamsocket#403)

makes it easier to consume the ClientToken for other rust libraries

* Add support for Y_SWEET_MAX_BODY_SIZE (jamsocket#405)

This PR adds support for `Y_SWEET_MAX_BODY_SIZE` environment variable to
override the default axum websocket body size of 2MB

* better websocket URL generation (jamsocket#406)

* v0.9.0 (jamsocket#408)

* add websocket pings/pongs to help close zombie connections (jamsocket#410)

* fix some websocket server issues (jamsocket#411)

One of these fixes an issue I introduced in my last PR. The other is
pre-existing.

* v0.9.1 (jamsocket#412)

* Allow pycrdt up to and including 0.12.x (jamsocket#414)

Fixes jamsocket#400

Tested locally:

```
uv run pytest
......                                                                                                                                 [100%]
6 passed in 20.34s
```

* only persist documents to S3 when dirty (jamsocket#416)

Fix an issue where y-sweet was persisting documents to S3 every ~10
seconds even when no changes had occurred.

From what I understand, the persistence worker wakes up both on the
dirty signal and also on a `checkpoint_freq` interval and was always
calling persist, regardless of the dirtiness, which would write it to S3
regardless of whether any changes had been made.

The fix adds a check to only persist when the document is actually
dirty.

I'm still a little bit unclear behind the reasoning for the logic of
signaling the worker both on a dirty callback and on a timer.

So I wonder if we instead just start the worker once, wake every 10
seconds, check if dirty, persist if needed.

* use SeqCst ordering for sync_kv dirty flag (jamsocket#417)

Now that [we're not persisting unless the document is marked
dirty](jamsocket#416), let's use an
atomic ordering with stronger guarantees for the KV store's `dirty`
flag.

* Allow to disable GC within documents using env variable/CLI (jamsocket#422)

### References

- closes jamsocket#421 

### Description

Adds an option to disable GC within documents (distinct from GC of
documents in multi-document mode) via:
- CLI by passing `--skip-gc` to either of `y-sweet serve` or `y-sweet
serve-doc`
- `Y_SWEET_SKIP_GC` environment variable

I was not sure if I should also add the environment variable to
`y-sweet-worker` for feature parity but given that it is deprecated I
went for a smaller changeset and only added it in the server.

I wonder if the configuration for toggling GC of documents themselves
(the `doc_gc` option which is not exposed by clap) would be advisable,
but I think it is already possible to configure
`checkpoint_freq_seconds` instead which can be set to a very high value
that is probably better than turning it off altogether.

* feat: divide before main stream

* fix: lint

---------

Co-authored-by: Theodor Tonum <theodor@tonum.no>
Co-authored-by: Vinay M <rmdort@gmail.com>
Co-authored-by: Taylor Baldwin <taylorbaldwin@gmail.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Aleksey Smolenchuk <lxe@lxe.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to run with garbage collection disabled?

2 participants