Page MenuHomePhabricator

[services] Tunnelbroker - Update on using of `init` in Rust notifications library
AbandonedPublic

Authored by max on Oct 10 2022, 7:15 AM.
Tags
None
Referenced Files
F3517186: D5330.diff
Sun, Dec 22, 4:33 PM
Unknown Object (File)
Sun, Dec 15, 6:52 PM
Unknown Object (File)
Thu, Nov 28, 11:31 PM
Unknown Object (File)
Thu, Nov 28, 11:31 PM
Unknown Object (File)
Sun, Nov 24, 12:32 PM
Unknown Object (File)
Sun, Nov 24, 12:32 PM
Unknown Object (File)
Oct 25 2024, 5:18 PM
Unknown Object (File)
Oct 25 2024, 5:18 PM

Details

Summary

This diff introduces changes for using the init and a global configuration struct from D5329.
Instead of providing a certificate, fcm key for every function call we can initialize it once the service starts.

The function and struct are introduced in D5329.

Related Linear task: ENG-1737

Test Plan

Service is successfully built, and notifications are successfully sent.

Diff Detail

Repository
rCOMM Comm
Branch
notiflib-update-useof-init
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
jon requested changes to this revision.Oct 10 2022, 1:24 PM
jon added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
80–91 ↗(On Diff #17450)

we only need to read it once, and we should avoid vanilla panics

This revision now requires changes to proceed.Oct 10 2022, 1:24 PM
max added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
80–91 ↗(On Diff #17450)

we only need to read it once, and we should avoid vanilla panics

Makes sense, fixed. Thanks, @jon !

LGTM, feel like @tomek should take a look

tomek requested changes to this revision.Oct 13 2022, 7:39 AM
tomek added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
79–93

Using global variables isn't a good idea. We should use more object-oriented approach, where we have a struct with config fields and methods that use these fields. Is it possible to have something like this?

This revision now requires changes to proceed.Oct 13 2022, 7:39 AM
max marked an inline comment as done.
max marked an inline comment as done.

This diff is abandoned in a favor of D5641 and D5642.

services/tunnelbroker/rust-lib/src/lib.rs
79–93

Using global variables isn't a good idea. We should use more object-oriented approach, where we have a struct with config fields and methods that use these fields. Is it possible to have something like this?

This diff is abandoned in a favor of D5641 and D5642. The comment in D5329 is related to this question. The approach was changed to use a lazy static in D5641.