Skip to content

Commit

Permalink
The Great Refactor (part I): make SMS handling actually manageable
Browse files Browse the repository at this point in the history
- Messages now get shoved into the DB before anything else, meaning
  we never drop 'em on the floor. (fixes #14)
- SMS->Matrix handling has been completely reworked. Now, we create
  a UserManager (through the RecipientFactory) for each phone number,
  which can be prodded in order to make it get messages from the DB
  and deliver them. (fixes #13)
- Message delivery is now actually failure-tolerant as well!
  We do an exponential backoff for failures to deliver.
- We now do regular CMGLs if configured, and also if an earlier one
  failed to work completely. This can be configured with the cmgl_secs
  value in the configuration. (fixes #8)
- Modems without CNMI support now work with the above polling mechanism.
- We now use newer versions of glitch-in-the-matrix and huawei-modem.
  • Loading branch information
eeeeeta committed May 24, 2018
1 parent ffd92eb commit 9c9807a
Show file tree
Hide file tree
Showing 13 changed files with 711 additions and 267 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions Cargo.toml
Expand Up @@ -3,12 +3,6 @@ authors = ["eeeeeta <eeeeeta@users.noreply.github.com>"]
name = "matrix-appservice-sms"
version = "0.1.0"

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

[dependencies]
dotenv = "0.9"
env_logger = "0.5"
Expand All @@ -23,6 +17,7 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
tokio-core = "0.1"
tokio-timer = "0.2"

[dependencies.diesel]
features = ["postgres"]
Expand All @@ -32,8 +27,16 @@ version = "1.0"
git = "https://github.com/alexcrichton/futures-await"

[dependencies.glitch-in-the-matrix]
git = "https://github.com/eeeeeta/glitch-in-the-matrix"
branch = "develop"
git = "https://github.com/eeeeeta/glitch-in-the-matrix"

[dependencies.huawei-modem]
git = "https://github.com/eeeeeta/huawei-modem"

[profile]

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"
1 change: 1 addition & 0 deletions migrations/20180524130627_messages/down.sql
@@ -0,0 +1 @@
DROP TABLE messages;
7 changes: 7 additions & 0 deletions migrations/20180524130627_messages/up.sql
@@ -0,0 +1,7 @@
CREATE TABLE messages (
id SERIAL PRIMARY KEY,
recipient_id INT REFERENCES recipients ON DELETE CASCADE,
pdu bytea NOT NULL,
processing BOOL NOT NULL DEFAULT false,
failures INT NOT NULL DEFAULT 0
);

0 comments on commit 9c9807a

Please sign in to comment.