Questions tagged [deferred-execution]

219 questions
3
votes
1 answer

Why in javascript deferred callbacks don't create race conditions?

So I wanted write something similar to this snipped from IndexedDB docs: var req; var store = getStore(); req = store.count(); req.onsuccess = function(evt) { console.log("success: " + evt.result); }; req.onerror = function(evt) { …
3
votes
1 answer

What comes first .always() or .then() callbacks in jQuery?

If you have a function which has both .then and .always callbacks, which one will get executed first?
aaron-coding
  • 2,571
  • 1
  • 23
  • 31
3
votes
4 answers

Proper pattern to encapsulate log setup in golang

When trying to move log setup code into a separate function I ran into inability to hide the destination file object from the main function. In the following INCORRECT simplified example the attempt is made to setup log writing to both Stderr and a…
Vlad Didenko
  • 4,481
  • 4
  • 25
  • 34
3
votes
1 answer

IEnumerable result from a method and deferred execution

I understand deferred execution in LINQ as explained here: What are the benefits of a Deferred Execution in LINQ? However, deferred execution can lead to bugs especially in multithreaded scenarios eg. evaluation performed on a shared collection…
JohnC
  • 335
  • 3
  • 12
3
votes
2 answers

What is the best bucket size for a task queue filled with many deferred tasks in Google App Engine?

My Google App Engine application is adding a large number of deferred tasks to a task queue. The tasks are scheduled to run every x seconds. If I understand the bucket-size property b correctly, a high value would prevent the deferred tasks to run…
Ingo
  • 1,552
  • 10
  • 31
3
votes
2 answers

Method not getting called correctly when passing Func as argument

I've been trying to get this method to work since yesterday and have taken to pulling my hair out - Basically, I have a method that retrieves articles from a database. Below is the method code: public static IEnumerable
cchamberlain
  • 17,444
  • 7
  • 59
  • 72
3
votes
2 answers

why there is no response_finished signal in Django?

I am trying to implement some kind of background task queue in Django, because Celery is too huge & complex, then it occured to me that, there is already a signal called…
est
  • 11,429
  • 14
  • 70
  • 118
2
votes
1 answer

LINQ functions and DataContext disposal, deferred execution

So I need some advice and insight here. Thanks in advance for your thoughts. I have developed static functions that return a single record from a LINQ entity. Like so: FooRecord GetRecord(Guid id) { using(var dc = new FooDataContext()) …
Mark Williams
  • 583
  • 7
  • 18
2
votes
1 answer

Performance impact of async vs defer in 3rd party script tag

How does the use of async and defer differ when considering the script execution after download and its impact on page performance? Async Blocks the parsing of the page when executed Executed as soon as it is available Defer Executes after the…
jamomani
  • 903
  • 1
  • 7
  • 19
2
votes
1 answer

Difference between `where` in the query object and `if` in the extension methods

I am studying LINQ. I don't know the difference between using if in extension method and using where in query object. The Console.WriteLine() results are the same, is there any difference in speed? If you think about it, there seems to be a…
user18024704
2
votes
0 answers

defer - modify named return value vs non-named return value

Code func deferModifyReturnValue() int { x := 0 defer func() { x += 1 // executed before return, }() return x } func deferModifyNamedReturnValue() (x int) { defer func() { x += 1 // executed before return, …
Eric
  • 22,183
  • 20
  • 145
  • 196
2
votes
1 answer

Execution order of dynamically added script tags marked with defer attribute?

I have some applications which dynamically create widgets. Some widgets need some libraries to be included (eg Codemirror, Tinymce, jQuery, ..). These scripts are dynamically added in document when the widget is first created, else they are not…
Nikos M.
  • 8,033
  • 4
  • 36
  • 43
2
votes
1 answer

Will two defer calls for the same function be both executed?

What happens to the defer in the code below? package main import "net/http" func main() { resp, _ := http.Get("http://google.com") defer resp.Body.Close() resp, _ = http.Get("http://stackoverflow.com") defer…
WoJ
  • 27,165
  • 48
  • 180
  • 345
2
votes
0 answers

EclipseLink Nullpointer while executing deffered events(AbstractSession.executeDeferredEvents) with lazy loading

I am getting a NullPointer from EclipseLink during Lazy loading of Children. This is not happening always, but it happens once in a while and once it gets into this exception, it keeps throwing the same NullPointer then on. My Entity Structure…
2
votes
1 answer

How do I write a Plack middleware that runs after the HTTP response is sent to the client?

My Plack web service logs via a TCP connection to fluentD, and I'd like to execute my logging code after I've sent the response back to the client. This would reduce response time (assume this is a high request volume service where such a…
Aaron
  • 412
  • 1
  • 7
  • 11