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
F2905203: D5330.id17534.diff
Sun, Oct 6, 3:56 AM
Unknown Object (File)
Thu, Sep 26, 9:28 PM
Unknown Object (File)
Mon, Sep 9, 7:33 PM
Unknown Object (File)
Mon, Sep 9, 7:33 PM
Unknown Object (File)
Sep 5 2024, 7:48 AM
Unknown Object (File)
Sep 5 2024, 7:48 AM
Unknown Object (File)
Sep 1 2024, 6:56 AM
Unknown Object (File)
Sep 1 2024, 6:56 AM

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

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

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 ↗(On Diff #17534)

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 ↗(On Diff #17534)

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.