If I want to create an async queue with concurrency = 1, I use promises like so:
let p = Promise.resolve()
export const runTask(run, onerror){
return p = p.then(run, onerror);
}If I want to create an async queue with concurrency = 1, I use promises like so:
let p = Promise.resolve()
export const runTask(run, onerror){
return p = p.then(run, onerror);
}| { | |
| "from": 0, | |
| "query": { | |
| "bool": { | |
| "must": [ | |
| { | |
| "simple_query_string": { | |
| "query": "*" | |
| } | |
| }, |
| #!/usr/bin/env bash | |
| # the nice thing about this script is it will remove | |
| # existing containers in the background | |
| # while the new image is being built | |
| set -eo pipefail | |
| cd "$(dirname "$BASH_SOURCE")" | |
| ( |
| FROM golang:1.13 as base_img | |
| ADD ./netrc /root/.netrc | |
| ENV GO111MODULE='on' | |
| ENV GOPROXY='direct' | |
| ENV GOSUMDB='off' | |
| RUN mkdir -p /tmp/go-api |
| package common | |
| import ( | |
| "cloud.google.com/go/compute/metadata" | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "github.com/acme/go-api/config/proj" | |
| jwtgo "github.com/acme/jwt-go" | |
| "golang.org/x/oauth2" |
This problem:
let mightChange = {id:1}
const doWork = async v => {
const result1 = await doSomethingWith(mightChange);
const result2 = await doAnotherThingWith(mightChange); // mightChange.id might be mutated
return doSomething(result2)well here is the output of cat /etc/os-release:
oleg@xps:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debianIf you copy this file and transpile with tsc, you will see that the headers get buffered, but the body is streamed line-by-line, where a new line of JSON arrives to the client every second. But is there a way to stream headers too, not just the body?
import * as http from 'http';
const server = http.createServer((req,res) => {