wellington / go-libsass

Go wrapper for libsass, the only Sass 3.5 compiler for Go
http://godoc.org/github.com/wellington/go-libsass
Apache License 2.0
206 stars 28 forks source link

Concurrent task cancels out #44

Closed iamajoe closed 7 years ago

iamajoe commented 8 years ago

Hi,

I was trying to set concurrency with this package and a simple copy task. It seems like go-libsass "cancels" other concurrencies.

Here are my routines and here is the code calling go-libsass.

drewwells commented 8 years ago

You can not cancel goroutines. You can count them, manually, but there's no way to cause a goroutine to die other than the one you are currently executing in. Are you seeing specific errors while compiling Sass?

iamajoe commented 8 years ago

No. No errors. Things just don't happen. Sass compilation always happens. I have implemented an "order of tasks" to run and if I leave sass compilationin its own order, everything works fine but that would remove the need for a go routine.

drewwells commented 8 years ago

Try using sync.Wait the program may exit before all routines are finished

On Tue, May 31, 2016, 1:34 AM Joel Santos notifications@github.com wrote:

No. No errors. Things just don't happen. Sass compilation always happens. I have implemented an "order of tasks" to run and if I leave sass compilationin its own order, everything works fine but that would remove the need for a go routine.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/wellington/go-libsass/issues/44#issuecomment-222603510, or mute the thread https://github.com/notifications/unsubscribe/AAOmE1QtMo2_6PjUPTEtQ4pBZoDM7Lqaks5qG9ZZgaJpZM4Ip6dp .

iamajoe commented 8 years ago

I'm already doing that...

drewwells commented 8 years ago

Need more details. Do the other routines start at all? Do they fail? What are they expected to do?

On Tue, May 31, 2016, 9:45 AM Joel Santos notifications@github.com wrote:

I'm already doing that...

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/wellington/go-libsass/issues/44#issuecomment-222711305, or mute the thread https://github.com/notifications/unsubscribe/AAOmE4yogoGPSqIxcLwjml44xOGuuGLdks5qHEmdgaJpZM4Ip6dp .

iamajoe commented 8 years ago

My project is a task system for other projects. You can copy, remove, rename files, minify css, minify js... So, I set two copies of files and one sass (just as an example). The three tasks are go routines. If they run in the same order (which is a key I have to order the tasks as a pipeline) it becomes truly inconsistent with the style task. Sometimes a file copy and the other doesnt, sometimes it enters the go routine (noticing by the logs) but then there isn't a copy... If I comment the style task the copies work marvelously. If the style task is enabled the style task always finishes is just the other tasks that don't. This is the reason I said it seems like it "cancels" the others.

I know it is kind of a lot since it is another project to know about but did you understand this ramble?

drewwells commented 8 years ago

Definitely want to make sure go-libsass works with other code. I think I see what you are doing here.

Looking at the routine code, it looks like you are just logging errors rather than returning them up. What input are you providing and what are the logs saying? It looks like it should log even if the err is nil.

One thing I do notice, since order isn't enforced in the file operations. It may run in a non-ideal order:

For example, copy built.tar build/ remove build/*

when it may be intended to remove build/* copy built.tar build/

iamajoe commented 8 years ago

Yes you can run removes and whatnot at the same time but that adds flexibility. If you see this example I set the remove first order and then the rest go on a next order. Exactly so that tasks don't mix up.

The logs just say stuff like "Started task". What do you mean by input?

drewwells commented 7 years ago

Is this still relevant? It looks like the branch is gone and the project is now node. Feel free to comment if this is still an issue.