Re: [go-nuts] Performance hit when using goroutine

2018-05-21 Thread Jan Mercl
On Tue, May 22, 2018 at 7:12 AM Hawari Rahman wrote: > Is there something that I need to address in the previous code snippet? It's necessary to analyze and understand the code to figure out if adding concurrency makes sense. Just running many tasks in goroutines does not per se guarantee any im

Re: [go-nuts] Performance hit when using goroutine

2018-05-21 Thread Hawari Rahman
After some more detailed investigation, it seems the most time consuming process is a "Select by IDs" query. So to hydrate a Collection object, I need to retrieve another objects through a SELECT WHERE id = ANY(?)" query in postgres. I'm curious on how the performance can differs greatly when c

Re: [go-nuts] Performance hit when using goroutine

2018-05-21 Thread Hawari Rahman
Hi Burak, Thank you for your reply, Inside the HydrateCollection function there are database queries (at least three), run using the same *sql.DB throughout the application. Is it possible that > whatever connection HydrateCollection is operating on cannot handle > multiple concurrent requests

Re: [go-nuts] Performance hit when using goroutine

2018-05-21 Thread Burak Serdar
On Mon, May 21, 2018 at 11:12 PM, Hawari Rahman wrote: > Hi Everyone, > > So for the background, I have an API for retrieving data from a database. > For an endpoint there exists two function calls: > - SelectCollections - for retrieving the collection records > - HydrateCollection - for hydrating

Re: [go-nuts] Why doesn't this select statement timeout?

2018-05-21 Thread Burak Serdar
On Mon, May 21, 2018 at 12:13 PM, wrote: > timeout := 1 * time.Millisecond > select { > case ch <-f(req): > case <-time.After(timeout): > ch <- errors.New("timeout") > } The instant 'select' is evaluated, ch is writable. Also time.After() is called, and returns a channel that will be ready to be

[go-nuts] Performance hit when using goroutine

2018-05-21 Thread Hawari Rahman
Hi Everyone, So for the background, I have an API for retrieving data from a database. For an endpoint there exists two function calls: - SelectCollections - for retrieving the collection records - HydrateCollection - for hydrating each collections (the second function is called on each results

[go-nuts] Why doesn't this select statement timeout?

2018-05-21 Thread gopher . nutter
The following setup uses a select statement to either wait for a response error or timeout after a given duration. The httptest.Server is setup to force the timeout by sleeping (1 sec) for greater than the timeout (1 millisec). But the timeout case isn't being hit at all, why? what is wrong wit

[go-nuts] Re: http.ReadRequest doesn't recognize http2?

2018-05-21 Thread Ankit Gupta
This issue is now opened https://go-review.googlesource.com/c/113817/ I am still looking for an alternative though - to know if a certain sequence of bytes contains http2 data with method/headers/body. On Monday, May 21, 2018 at 5:24:09 PM UTC+5:30, Ankit Gupta wrote: > > Hello gophers, > > I am

[go-nuts] Re: Collider setup

2018-05-21 Thread Jong Hyuck Won
How did you resolve this? I am new to go/collider, and having the same issue when trying to run the server as instructed here https://github.com/webrtc/apprtc/blob/master/src/collider/README.md . Thanks in advance. - Dennis -

[go-nuts] From PHP to Go, here my first side project. What do you think?

2018-05-21 Thread Matthieu Cneude
Hello everybody, I am a PHP developer for many years and I am trying to learn Golang. I think knowing a language which offer low level possibilities can be a very good complement to a more high level language. Therefore I wrote a little application which watch tests file and run them here: http

[go-nuts] golang call windows service api QueryServiceStatusEx

2018-05-21 Thread lixin20101023
Dear Gophers, I use golang version 1.10 call windows api to get the specified name service status, i know golang/sys/windows have QueryServiceStatus() function , but return no process id. And i see windows api doc: QueryServiceStatus() function has been superseded by the *QueryServiceStatusEx*

[go-nuts] Re: I am confused.

2018-05-21 Thread matthewjuran
Emacs (https://www.gnu.org/software/emacs/), Notepad++ (https://notepad-plus-plus.org/), and Vim (https://www.vim.org/) are code editors that work on Windows. I use Vim on macOS. Emacs and Vim will take longer to learn than Notepad++. These editors let you open and modify code files (right clic

[go-nuts] Re: I am confused.

2018-05-21 Thread bucarr
1. How much room do you have on your C:\ drive? (if the drive is mostly full, you need to delete a bunch of stuff) 2. Is there a directory shown as C:\Go (if so, delete it entirely) 3. Did you download the .msi directly from the golang download site? (if not, delete the .msi you have and redown

[go-nuts] http.ReadRequest doesn't recognize http2?

2018-05-21 Thread Ankit Gupta
Hello gophers, I am trying to read http2 request on a tcp connection, which is set up like this - cert, err := tls.LoadX509KeyPair(certfile, certkeyfile) if err != nil { return nil, err } tlsConfig := &tls.C

[go-nuts] Re: HTTP/2 Server Push - what is happening during 'Reading Push' ?

2018-05-21 Thread rasmusj . se
To whom it may concern, I have found the reason for this problem. It's a bug i dev-tools not Go, check my blog post on the matter for more details https://blog.rasmusj.se/2017/03/bug-network-throttling-in-google-chrome.html -- You received this message because you are subscribed to the Google G

[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?

2018-05-21 Thread Darren Hoo
Hi Dave, I haven't made it clear on the first post, sorry, I am talking about the behavior of Go's net/http.Client, so there are no browsers involved. Go's net/http.Client will do redirections transparently for user, but there are no exposed way of get the redirected url. see https://play.gol

[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?

2018-05-21 Thread Dave Cheney
Please keep in mind that the Via header is supplied by he client (the browser) and there is not requirement that it maintains the full chain of custardy of all the urls it has passed though, nor is there any way for Go to know nor enforce that this list remains accurate. Sorry. -- You receive

Re: [go-nuts] db interface design

2018-05-21 Thread yang sheng
On Monday, May 21, 2018 at 3:47:59 AM UTC-4, Sergey Kamardin wrote: > > > 1. there are a lot of similar functions, for example NewBook and > NewAuthor. > > The difference is type of argument passed into the function. Is it a > good > > idea to combine those 2 functions with a generic New(inte

Re: [go-nuts] db interface design

2018-05-21 Thread Sergey Kamardin
> 1. there are a lot of similar functions, for example NewBook and NewAuthor. > The difference is type of argument passed into the function. Is it a good > idea to combine those 2 functions with a generic New(interface{}) (string, > error) function and reflect the actual type inside? I would