Skip to content

Commit 7268b22

Browse files
committed
Merge branch 'main' of github.com:cheerfulstoic/ecto_watch
2 parents 33c2dff + 53a0625 commit 7268b22

File tree

8 files changed

+14
-16
lines changed

8 files changed

+14
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Often in Elixir applications a `Phoenix.PubSub.broadcast` is inserted into the a
1313
* Often full records are used which can scale poorly since messages in Elixir are copied in memory when sent.
1414
* Sometimes records are sent preloaded with different associations in different cases, requiring either careful coordination or sending all associations regardless of where they are needed.
1515

16-
By getting updates directly from PostgreSQL, EctoWatch ensures that messages are sent for *every* change (even changes from other clients of the database). EctoWatch also establishes a simple, standardized set of messages for inserts, updates, and deletes so that there can be consistency across your application. By default only the id of the record is sent (makeing for smaller messages).
16+
By getting updates directly from PostgreSQL, EctoWatch ensures that messages are sent for *every* change (even changes from other clients of the database). EctoWatch also establishes a simple, standardized set of messages for inserts, updates, and deletes so that there can be consistency across your application. By default only the id of the record is sent (making for smaller messages).
1717

1818
## Example use-cases for `EctoWatch`
1919

@@ -121,5 +121,5 @@ be found at <https://hexdocs.pm/ecto_watch>.
121121
[^1]: more info about PubSub message standards:
122122
- Having a single topic (e.g. `users`) means that all messages are sent to all subscribers, which can be inefficient.
123123
- Having a topic per record (e.g. `users:1`, `users:2`, etc.) means that a subscriber needs to subscribe to every record, which can be inefficient.
124-
- There may be inconsistancy in pluralization of topics (e.g. a `user` vs. `packages` topics) which can be confusing and lead to bugs.
124+
- There may be inconsistency in pluralization of topics (e.g. a `user` vs. `packages` topics) which can be confusing and lead to bugs.
125125
- Having a message that is just `{:updated, id}` doesn't make it clear which schema was updated, using `{schema, id}` doesn't make it clear which operation happened.

guides/howtos/Upgrading Versions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def handle_info({:inserted, Comment, %{id: id}}, socket) do
3737
# ...
3838
```
3939

40-
With versios 0.8.0 the update type is implied by the label, so you can subscribe simply by doing:
40+
With version 0.8.0 the update type is implied by the label, so you can subscribe simply by doing:
4141

4242
```elixir
4343
# subscribe:
@@ -64,9 +64,7 @@ def handle_info({{Comment, :inserted}, %{id: id}}, socket) do
6464

6565
You can think of the first argument of `subscribe` or the first element of the tuple as an lookup identifier for the watcher which is either `{ecto_schema(), update_type()}` or a label atom. So handling a label would just be:
6666

67-
6867
```elixir
6968
def handle_info({:title_or_body_updated, %{id: id}}, socket) do
7069
# ...
7170
```
72-

guides/other/Potental TODOs.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

guides/other/Potential TODOs.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
* Support features of `CREATE TRIGGER`:
2+
* allow specifying a condition for when the trigger should fire
3+
* Allow watchers to support adapter pattern. Potential adapters:
4+
* Phoenix PubSub (the default, would work like it does now)
5+
* GenStage producer
6+
* Creating a batch-processing GenServer to reduce queries to the database.
7+
* Allow for local broadcasting of Phoenix.PubSub messages

lib/ecto_watch/options.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ defmodule EctoWatch.Options do
99
%__MODULE__{
1010
repo_mod: opts[:repo],
1111
pub_sub_mod: opts[:pub_sub],
12+
debug?: opts[:debug?],
1213
watchers:
1314
Enum.map(opts[:watchers], fn watcher_opts ->
1415
WatcherOptions.new(watcher_opts, opts[:debug?])

lib/ecto_watch/watcher_server.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule EctoWatch.WatcherServer do
22
@moduledoc """
3-
Internal GenServer for the individiual change watchers which are configured by end users
3+
Internal GenServer for the individual change watchers which are configured by end users
44
55
Used internally, but you'll see it in your application supervision tree.
66
"""

lib/ecto_watch/watcher_trigger_validator.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule EctoWatch.WatcherTriggerValidator do
22
@moduledoc """
3-
Intenal task run as part of the EctoWatch supervision tree to check for a match between the triggers
3+
Internal task run as part of the EctoWatch supervision tree to check for a match between the triggers
44
that are in the database and the triggers that were started via the configuration.
55
66
Used internally, but you'll see it in your application supervision tree.

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ defmodule EctoWatch.MixProject do
7878
"guides/introduction/Testing.md",
7979
"guides/introduction/Notes.md",
8080
"guides/howtos/Upgrading Versions.md",
81-
"guides/other/Potental TODOs.md",
81+
"guides/other/Potential TODOs.md",
8282
"CHANGELOG.md"
8383
]
8484
end

0 commit comments

Comments
 (0)