2.0 KiB
How to contribute
Howdy! Usual good software engineering practices apply. Write tests. Write comments. Follow standard Rust coding practices where possible. Use 'cargo fmt' and 'clippy' to tidy up formatting.
There are soft spots in the code, which could use cleanup, refactoring, additional comments, and so forth. Let's try to raise the bar, and clean things up as we go. Try to leave code in a better shape than it was before.
Rust pitfalls, async or not
Please be aware of at least these common problems:
-
Async and Cancellation
Any future can be cancelled at every await point unless it's a top level spawned future. Most common reasons to be cancelled or dropped is that a future is polled or raced within
tokio::select!with a cancellation token or the HTTP client drops the connection, causing a cancellation or drop on a handler future.Additionally please note that blocking tasks spawned with
tokio::spawn_blockingdirectly or indirectly will not be cancelled with the spawning future. -
When using
scopeguardor generally withinDrop::drop, the code must not panicscopeguardcan be handy for simple operations, such as decrementing a metric, but it can easily obscure that the code will run onDrop::drop. Should a panic happen and the implemented drop also panic when unwinding, the rust runtime will abort the process. Within a multi-tenant system, we don't want to abort, at least for accidentalunwrapwithin aDrop::drop.
Submitting changes
-
Get at least one +1 on your PR before you push.
For simple patches, it will only take a minute for someone to review it.
-
Don't force push small changes after making the PR ready for review. Doing so will force readers to re-read your entire PR, which will delay the review process.
-
Always keep the CI green.
Do not push, if the CI failed on your PR. Even if you think it's not your patch's fault. Help to fix the root cause if something else has broken the CI, before pushing.
Happy Hacking!