Questions tagged [future]

A placeholder for the result of a calculation before the calculation has completed. Used in concurrent programming. Questions about future events are off-topic on Stack Overflow.

future
Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Multiple streamed response combined in a single iterator in Scala

I have multiple replicas of a service from which I am receiving a stream of response: // RPC call to server that returns a stream of response. def getResult(input: Request): Iterator[ResultItem] On ...
Kyuubi's user avatar
  • 1,228
2 votes
1 answer
71 views

C++ multiple promises for one task

My use-case is rather common. I have a class that performs some asynchronous operation: e.g. get some data asynchronously from a service; I can have multiple requests (get_data calls) for that ...
andreig1978's user avatar
-1 votes
0 answers
28 views

Why is RxJava switchIfEmpty() always being triggered in my function? [closed]

I'm calling: getMyItem().switchIfEmpty() where getMyItem() returns a Maybe.fromFuture(). It seems like the switchIfEmpty() clause is not being subscribed to the getMyItem() result (I'm 100% positive ...
DrPibb's user avatar
  • 1
-1 votes
2 answers
57 views

Blocking wait on future OUTSIDE of async functions

I'm starting to get pretty frustrated with Dart's async ... All I want is lazily load some value and assign it to a property in my class: Future<String> getMeSomeBar() async => "bar"...
User1291's user avatar
  • 7,912
0 votes
1 answer
48 views

how to avoid while loop while waiting for future complete?

I have a problem with a java future and an handler function. code example: public HealthCheckResponse call() { String redisHost = this.configuration.getRedisHost(); log.info("connect to ...
Jan Kück's user avatar
  • 125
0 votes
1 answer
28 views

Update a reactive value in a function

Context I have a for loop that parallelizes code with future package. I have to write the results to a csv file. To avoid conflict problems and other problems. I segmented the loop into two for loops. ...
unshiny's user avatar
0 votes
0 answers
34 views

Checking status of std::future from other thread

We have a COM server that provides a scripting service to clients. A client may initiate a script and wait for the result, or it may initiate a script and not wait for the result. In the cases where ...
ttemple's user avatar
  • 862
1 vote
2 answers
75 views

Yielding control in Java asynchronous code

I come from a Rust/C#/Javascript background for asynchronous programming, and trying to understand comparable Java idioms. Specifically, I'm trying to understand whether there's a "green threads&...
nihohit's user avatar
  • 548
1 vote
1 answer
97 views

How to cancel Future.wait (in dart)?

I have two Future functions which I run asynchronously: List<Future<bool>> jobs = []; jobs.add(asyncFunction1()); jobs.add(asyncFunction2()); jobsResults = await Future.wait(jobs); If ...
user23064699's user avatar
0 votes
0 answers
46 views

Unknown Error Message: Check for javascript errors

I have 2 questıons . 1)While writing code, this message appears on the developer console screen :'Unknown Error Message: Check for javascript errors. How can I solve this problem? İn apex job my ...
Destina Özgür's user avatar
1 vote
1 answer
41 views

Scala wait Await.result for Future.sequence, which futures did not complete on time?

I have list of futures and Await val listWithResult = Await.result(Future.sequence(listOfFutures), 10.minutes) It fails with java.util.concurrent.TimeoutException: Futures timed out after [10 minutes]...
Capacytron's user avatar
  • 3,615
0 votes
0 answers
29 views

Convert Future<Object> to Object model after parse json in initState flutter

Im new in flutter so Iam playing aroung and would be nice some hints, Illl apreciate alot. Thank you for your timeind advance. I parse data from http, so I use Future but i want to convert into real ...
Juan Torres's user avatar
0 votes
2 answers
53 views

Scala for comprehension responding Future.filter predicate is not satisfied

I got the followin code val obj1Seq: Future[Seq[Object1]] = /* call function returning Future[Seq[Object1]] */ val obj2Seq: Future[Seq[Object2]] = /* call function returning Future[Seq[Object2]] */ ...
ahabrahante's user avatar
0 votes
2 answers
43 views

How to handle errors coming back from Futures when I am not awaiting the Future?

I have something like this: Future<void> f1() { ... } Future<void> f2() { ... } Future<void> f3() { ... } void main() async { f1(); f2(); // might throw an Exception await f3(...
Adam Rose's user avatar
1 vote
0 answers
49 views

When is furrr::future_pmap() faster than pmap()?

I implemented a function that is quite expansive. start<-Sys.time() plan(multicore, workers = 4) grid <- expand.grid(v,x,y,z) mapping<-pmap(list(grid[,1],grid[,2],grid[,3],grid[,4]),.f=...
mexx's user avatar
  • 11
0 votes
1 answer
66 views

Map value from a Future to Object and not Future[Object]

I have a function that return a Future[State] and another function that I need return a StateSimplified object //class State case class State(id: String, label: String, postalCode: String, extension: ...
ahabrahante's user avatar
3 votes
3 answers
282 views

Is checking both `snapshot.hasData` and `snapshot.data != null` redundant in Flutter's FutureBuilder?

I'm working with Flutter's FutureBuilder and came across a pattern where both snapshot.hasData and snapshot.data != null are checked before rendering a widget: FutureBuilder( future: future, ...
MendelG's user avatar
  • 18k
0 votes
0 answers
88 views

How can I wait for the return value of queue.pop()?

When my http listener gets a request it returns the response immediately. But I want to pop and return the value of queue.pop(), only when there is a value in the queue, and if there is no value, I ...
hoson's user avatar
  • 21
1 vote
0 answers
57 views

Is there any way to parallelize with plumber in windows?

I want to parallelize a task with plumber, handling multiple requests at the same time. I have found an example that I have put in practice in windows and it doesn't work, but taking the same example ...
Jose Luis's user avatar
1 vote
1 answer
119 views

Varying results using multiple threads

I'm trying to optimize the running time of my C++ code by utilizing multiple threads. I have tried a few different solutions. I have this code using boost: #include <iostream> #include <...
Jonas Örnfelt's user avatar
-2 votes
1 answer
167 views

future cannot be sent between threads safely

I want to implement jwt via from_request, but an error occurs that says that Send is not implemented. Whereas, if you remove the trait implementation for the structure, the error disappears (i.e.: ...
Vlad's user avatar
  • 1
2 votes
1 answer
454 views

Flutter FutureBuilder keeps Firing and rebuilding. It Generates a New Random Number on Every Rebuild - How can I Prevent This?

Context I am encountering an issue with FutureBuilder in Flutter where it recreates its Future on every widget rebuild, causing unexpected behavior in my app. Specifically, I have a FutureBuilder that ...
MendelG's user avatar
  • 18k
0 votes
1 answer
114 views

Why executor service submitted task is not executing the task async?

I'm trying to play with async java in my intellij local. My intention is that i will call calucalateAsync() method from main method and then put the debug point on System.out.println("calculate ...
vinter's user avatar
  • 518
0 votes
0 answers
34 views

Wrap into Combine (Promise-Future) code with 2 completions/branches?

https://developers.google.com/admob/ios/privacy class ViewController: UIViewController { // Use a boolean to initialize the Google Mobile Ads SDK and load ads once. private var ...
Gargo's user avatar
  • 1,298
0 votes
1 answer
40 views

How do I return this boolean from the Future function?

I have a function which is listening to the changes in a document to determine whether the user is online or offline, but I am unable to return the boolean and the default value is being returned ...
Syed A.R's user avatar
  • 199
0 votes
1 answer
75 views

Can multiple threads copy a std::shared_future at the same time?

Is a shared_lock enough in GetNextImage(), or do I need to use a unique_lock? shared_future<Mat> shfutNextImage; shared_mutex shmutNextImage; shared_future<Mat> GetNextImage() { ...
kovacs lorand's user avatar
1 vote
1 answer
142 views

Implement an async builder pattern in Rust

I want to implement a future for a builder. This can be common for examples such as configuring a request via a builder, then sending it off. I want to implement IntoFuture for a builder but I cannot ...
Jinyoung Choi's user avatar
0 votes
0 answers
15 views

Time Series Binary Prediction

I want to create a model to predict customer departure (churn) based on monthly time-series data. My data does not contain direct labels indicating churn, so I am considering using revenue (income) as ...
claimbed's user avatar
0 votes
0 answers
62 views

How to time a ListenableFuture

I want to track how long an async process takes. My general approach for synchronous processes is to record the current time, run the process, and finally calculate and record the difference. I use an ...
kane's user avatar
  • 5,757
0 votes
2 answers
59 views

async keyword Future<dynamic> problem in flutter/dart . I just want to know how the code is generating an error here below

I dont know what is happening in this portion of code: Future fnct() { print("inside fnct()"); return Future.delayed(Duration(seconds:4),()=>"hello"); } Future fnct2() ...
Weirdo Memes's user avatar
0 votes
2 answers
46 views

Flutter/Dart Future

class _WorterBuchState extends State<WorterBuch> with TickerProviderStateMixin { var wordPair= '' ; @override void initState(){ super.initState(); load(); } Future<void> ...
LeBron James's user avatar
1 vote
0 answers
36 views

How do I Wrap Functions Presented by plumber for Work in Promises

I have about 20 typical functions like: echo_delayed <- function(j){ jj <<- j # for debugging purpose Sys.sleep(1.5) print(paste0('echo_delayed - ', now() %>% toString(), " &...
asd-tm's user avatar
  • 5,124
0 votes
1 answer
409 views

I have two queueable jobs running in a transaction how to resolve it

On Order Product object I have an integration with a 3rd party system, which sends data the 3rd party whenever the Order Product through Queueable class. Now I am trying to insert a set of records to ...
Akshay Vasu's user avatar
0 votes
1 answer
111 views

Forcing a QiChatbot to reply to a phrase typed by the user

I am working on a Pepper application on android that uses a QiChatbot to communicate with users about minerals. I want to make the chatbot also available for on-screen use for people with hearing and/...
George Karageorgiou's user avatar
2 votes
2 answers
41 views

Future and DispatchQueue generating build error

I am trying to build a swift app, and I am opening a JSON file. As it could be time-consuming on the main thread, I want to do it in background. Here is the call I am doing using Future and ...
Seb's user avatar
  • 3,097
0 votes
2 answers
58 views

Get worker name from multisession framework provided by future package

I am parallelizing the data analysis via multiplesession plan of future package. The dataset is large. I tried to let each worker return the model fitting output to the main R session, and write the ...
David Li's user avatar
0 votes
0 answers
22 views

how to calculate the future in a past period? pine script

I am trying to convert to pine script the following thinkscript indicator which checks and calculates a current value based in past periods (where available data is available) and I have not found out ...
abe popo's user avatar
0 votes
1 answer
64 views

Feed subtasks with values, how to do?

I want a main thread which can give values to a number of subtasks (where the subtasks takes long time to execute) and where I do not want to end the subtasks and restart them with new values. I try ...
Suno's user avatar
  • 3
2 votes
1 answer
65 views

Flutter pass dynamic snapshot to another page

I have a page where I get snapshot returned as Future<List<RaceModel>>. Then on my widget I use a ListView.builder to display the data, which is ok: class _DashboardState extends State<...
Ivan's user avatar
  • 21
3 votes
1 answer
110 views

How does Ctrl-C work with multiple processes in python?

I am trying to distribute work across multiple processes. Exceptions that occur in another process should be propagated back and handled in the main process. This seems to work for exceptions thrown ...
BlackCatCoder's user avatar
0 votes
0 answers
22 views

Future that returns large data works on emulator but not physical device

I have a page that returns a list of audio files on the host device and i want to use the details of these files to create a list of audio files but it doesn't work on physical device(keeps loading) ...
Faruk Abdulganiyu's user avatar
0 votes
0 answers
59 views

List[Future[A]] => Future[(List[A], List[Throwable])] the most correct solution

I have solution: def foo[A](futures: List[Future[A]])(implicit ec: ExecutionContext): Future[(List[A], List[Throwable])] = futures.foldLeft(Future.successful(List.empty[A] -> List.empty[Throwable]...
andrey.ladniy's user avatar
0 votes
2 answers
111 views

Using Future blocks UI in application

In my Android app I want to use java.util.concurrent tools to make operations that return value (for educational purposes). I read that CompletableFuture can be used for this. I made a project where I ...
faritowich's user avatar
0 votes
0 answers
166 views

std::future::wait_for returns immediately timeout while the time duration has not elapsed

I have encountered an issue related to std::async and std::future::wait_for. I have the following code auto future = std::async(std::launch::async, [&](){return myfunction();}); auto status = ...
peidong zhou's user avatar
0 votes
1 answer
141 views

Limit of workers in future::plan() function higher than available CPUs cores

I have a CPU of 8 cores which I'm trying to use to do parallel future_map_chr(). My question is as follows: the number of cores in my computer is equal to 8, so how is it possible to parallelize ...
WalliYo_'s user avatar
  • 375
0 votes
0 answers
62 views

Trait bound's problem while processing Result<Vec<u8>, Box<dyn Error>>

I'm trying to build a matrix bot using matrix-rust-sdk based on the following example. use std::error::Error; use matrix_sdk::{ self, attachment::AttachmentConfig, config::SyncSettings, ...
Kirill Nesterov's user avatar
2 votes
0 answers
44 views

pass an async function into another async function in rust that return different types of results [duplicate]

I would like to write an async function that takes in another async function as a parameter: async fn do_sth_else(_ref: &str, _db: &DatabaseConnection) -> Result<i32, AppError> { /...
Quintessa's user avatar
1 vote
0 answers
77 views

Confused when using the completableFuture for reading the file

I tried to estimate the performance between async and sync. I wrote some easy async code which is reading the file and printing the result. I divided them into two parts, one is reading the file and ...
sclee1's user avatar
  • 1,217
0 votes
1 answer
94 views

flask_executor future.result() throws TypeError: 'str' object is not callable

I'm trying to get result from the process that I created to run in the background using flask_executor. This are methods in use: def scan_and_collect( self ): self.data_collector.collect() ...
Smok's user avatar
  • 107
0 votes
1 answer
68 views

Interrupt underlying execution of CompletableFuture

I havw this piece of code: CompletableFuture<Void> timeoutFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) .orTimeout(1, TimeUnit.SECONDS); // Set a ...
Nuñito Calzada's user avatar

1
2 3 4 5
78