|
| 1 | +--- |
| 2 | +pagefind: false |
| 3 | +title: Effect 3.19 (Release) |
| 4 | +excerpt: New Effect release featuring @effect/cluster improvements, HashRing module, Effect.fn improvements, and more! |
| 5 | +date: 2025-11-04 |
| 6 | +authors: |
| 7 | + - tim_smart |
| 8 | +tags: |
| 9 | + - Releases |
| 10 | + - Effect |
| 11 | +--- |
| 12 | + |
| 13 | +Effect 3.19 has been released! This release includes a number of new features |
| 14 | +and improvements. Here's a summary of what's new: |
| 15 | + |
| 16 | +## @effect/cluster improvements |
| 17 | + |
| 18 | +The `@effect/cluster` package has been significantly improved. The cluster system no longer requires a Shard Manager, and instead relies on the `RunnerStorage` service to track runner state. |
| 19 | + |
| 20 | +To migrate, remove any Shard Manager deployments and use the updated layers in `@effect/platform-node` or `@effect/platform-bun`. |
| 21 | + |
| 22 | +### Breaking Changes |
| 23 | + |
| 24 | +- `ShardManager` module has been removed |
| 25 | +- `EntityNotManagedByRunner` error has been removed |
| 26 | +- Shard locks now use database advisory locks, which requires stable sessions for database connections. This means load balancers or proxies that rotate connections may cause issues. |
| 27 | +- `@effect/platform-node/NodeClusterSocketRunner` is now `@effect/cluster/NodeClusterSocket` |
| 28 | +- `@effect/platform-node/NodeClusterHttpRunner` is now `@effect/cluster/NodeClusterHttp` |
| 29 | +- `@effect/platform-bun/BunClusterSocketRunner` is now `@effect/cluster/BunClusterSocket` |
| 30 | +- `@effect/platform-bun/BunClusterHttpRunner` is now `@effect/cluster/BunClusterHttp` |
| 31 | + |
| 32 | +### New Features |
| 33 | + |
| 34 | +- `RunnerHealth.layerK8s` has been added, which uses the Kubernetes API to track runner health and liveness. To use it, you will need a service account with permissions to read pod information. |
| 35 | + |
| 36 | +## HashRing module |
| 37 | + |
| 38 | +An experimental `HashRing` module has been added to the Effect core library. |
| 39 | + |
| 40 | +This module can be used to consistently distribute keys across a set of nodes. |
| 41 | + |
| 42 | +```typescript |
| 43 | +import { Data, HashRing, PrimaryKey } from "effect" |
| 44 | + |
| 45 | +// The "nodes" in the hash ring need to implement PrimaryKey |
| 46 | +class Host extends Data.Class<{ |
| 47 | + ip: string |
| 48 | +}> { |
| 49 | + [PrimaryKey.symbol]() { |
| 50 | + return this.ip |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +// Make an empty hash ring |
| 55 | +const ring = HashRing.make<Host>() |
| 56 | + |
| 57 | +// Add some nodes to the ring |
| 58 | +HashRing.add(ring, new Host({ ip: "192.168.1.1" })) |
| 59 | +HashRing.add(ring, new Host({ ip: "192.168.1.2" })) |
| 60 | +HashRing.add(ring, new Host({ ip: "192.168.1.3" })) |
| 61 | + |
| 62 | +// Get the node responsible for a given key |
| 63 | +const host = HashRing.get(ring, "my-key")! |
| 64 | +``` |
| 65 | + |
| 66 | +## Effect.fn.Return |
| 67 | + |
| 68 | +A new `Effect.fn.Return` type utility has been added to allow typing returns on `Effect.fn`. |
| 69 | + |
| 70 | +```typescript |
| 71 | +import { Effect } from "effect" |
| 72 | + |
| 73 | +const myfn = Effect.fn("myfn")(function* ( |
| 74 | + n: number |
| 75 | +): Effect.fn.Return<string> { |
| 76 | + return `Number is ${n}` |
| 77 | +}) |
| 78 | +``` |
| 79 | + |
| 80 | +## Other changes |
| 81 | + |
| 82 | +- `Graph` module updates have been backported from Effect v4 |
| 83 | +- `@effect/sql-pg` now uses the "pg" npm library as its backend |
| 84 | + |
| 85 | +There were several other smaller changes made. Take a look through the CHANGELOG to see them all: [CHANGELOG](https://github.com/Effect-TS/effect/blob/main/packages/effect/CHANGELOG.md). |
| 86 | + |
| 87 | +Don't forget to join our [Discord Community](https://discord.gg/effect-ts) to follow the last updates and discuss every tiny detail! |
0 commit comments