question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide more ways to run with Context

See original GitHub issue

In our codebase, we push RequestContext and immediately run some code with try-with-resources. For example:

try (SafeCloseable ignored = ctx.push()) {
    logger.trace(decorate(msg));
}

If RequestContext provides run(Runnable) or call(Callable) we can reduce boilerplate code and simplify it.

ctx.run(() -> logger.trace(decorate(msg));

This is inspired by gRPC Context API.
https://grpc.github.io/grpc-java/javadoc/io/grpc/Context.html#run-java.lang.Runnable-

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ikhooncommented, Jan 28, 2021

Sure, please take a look! 🙇‍♂️

0reactions
jongmin92commented, Jan 28, 2021

Could I handle this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use React Context like a pro - Devtrium
React Context can be a very powerful tool, and there are several tricks to using it effectively. Several patterns can be used to...
Read more >
How to use React Context effectively - Kent C. Dodds
In Application State Management with React, I talk about how using a mix of local state and React Context can help you manage...
Read more >
Context Managers and Python's with Statement
More and more objects in the Python standard library now provide support for the context management protocol so you can use them in...
Read more >
Provide more ways to bail out inside Hooks #14110 - GitHub
Wrote an article based on developing a Redux clone based on existing API - context and hooks which explains more. Two things are...
Read more >
How To Use Contexts in Go - DigitalOcean
In this tutorial, you will start by creating a Go program that uses a context within a function. Then, you will update that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found