[go-nuts] Cancellable, Efficient and Reliable Distributed Task Queue in Go

2022-08-24 Thread Ratin Kumar


https://github.com/dumbmachine/nq/
Hey everyone!
This is my first attempt at writing a useful golang library. At my current 
gig, I was in search of a task-queue that could guarantee cancellation of 
running jobs/tasks. While machinery/asynq are great libraries and we used 
them for a while, I ended up writing my own library to take advantage of 
nats and achieve a task queue that would behave as per requirements.

Feel free to critique, feedback is appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8b865467-4f14-42c3-8691-af86a0f07c8cn%40googlegroups.com.


[go-nuts] Some confusion about escape analysis

2022-08-24 Thread Lee Chou
I was try using net.Buffers for writev. But I meet a unexptected allocs in 
benchmark.  

https://go.dev/play/p/SHpxSYbP1I5

when I run the benchmark:

goos: linux
goarch: amd64
pkg: writev
BenchmarkWrite_Writev/escape-4   272901  4198 ns/op 
 24 B/op   1 allocs/op
BenchmarkWrite_Writev/noescape-4 273751  4267 ns/op 
  0 B/op   0 allocs/op
PASS
ok  writev3.410s

Is the noescape safe ? 
Is there a better way to avoid the alloc/escape ?
-
Best regards
Lee

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/04b23c46-b992-444d-b80e-cb02eaf06a43n%40googlegroups.com.


Re: [go-nuts] time.Truncate unexpected results in non-hour aligned timezones

2022-08-24 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-08-23 at 23:07 -0700, Mine GO BOOM wrote:
> Our system recently experienced a bug because of the surprise that
> sits (documented) inside of time.Truncate():
>
> """
> Truncate operates on the time as an absolute duration since the zero
> time; it does not operate on the presentation form of the time. Thus,
> Truncate(Hour) may return a time with a non-zero minute, depending on
> the time's Location.
> """
>
> Example of this surprise: https://go.dev/play/p/hZEHhj8QTZs
> currentTime: 2021-07-28 06:03:00 +0545 +0545
> truncated to one hour: 2021-07-28 05:45:00 +0545 +0545
> truncateTimezoneSensitive: 2021-07-28 06:00:00 +0545 +0545
>
> I see that time: could use a "truncate in timezone" feature was
> closed a long time ago with the comment: "The vast majority of
> truncation/rounding of times happens on units of 1 hour or smaller,
> and those are typically not sensitive to time zone." I do agree that
> most rounding/truncating does work on one hour or less (we sure do),
> but I'd say that it should be sensitive to time zones. The over a
> billion people in India (GMT +5:30) would agree with that, as they
> are the ones that reported the bug in our system.
>
> I would like to suggest this for an addition to the Go says
> WAT? collection.
>
> Can someone re-open the bug for further discussion?

I would recommend that you open a new issue rather than requesting the
old one be reopened. If you do, you should provide any new information
that is not discussed in the old issue that supports the need of the
feature.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bfd86b65f35b94e4cc49bf67f788cb2d00f5ba55.camel%40kortschak.io.


Re: [go-nuts] a function returning a function of type int

2022-08-24 Thread Jan Mercl
On Wed, Aug 24, 2022 at 7:23 AM Rino Mardo  wrote:

Example of a function returning a function: https://go.dev/play/p/9FY0GDhKJNd

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-Xa-onYNnuMa2WedMxL%2BrPsNyqjoW3PJ3TEZpyFy500%2Bw%40mail.gmail.com.


[go-nuts] time.Truncate unexpected results in non-hour aligned timezones

2022-08-24 Thread Mine GO BOOM
Our system recently experienced a bug because of the surprise that sits 
(documented) inside of time.Truncate() 
:

"""
Truncate operates on the time as an absolute duration since the zero time; 
it does not operate on the presentation form of the time. Thus, 
Truncate(Hour) may return a time with a non-zero minute, depending on the 
time's Location.
"""

Example of this surprise: https://go.dev/play/p/hZEHhj8QTZs
currentTime: 2021-07-28 06:03:00 +0545 +0545
truncated to one hour: 2021-07-28 05:45:00 +0545 +0545
truncateTimezoneSensitive: 2021-07-28 06:00:00 +0545 +0545

I see that time: could use a "truncate in timezone" feature 
 was closed a long time ago with 
the comment: "The vast majority of truncation/rounding of times happens on 
units of 1 hour or smaller, and those are typically not sensitive to time 
zone." I do agree that most rounding/truncating does work on one hour or 
less (we sure do), but I'd say that it should be sensitive to time zones. 
The over a billion people in India (GMT +5:30) would agree with that, as 
they are the ones that reported the bug in our system.

I would like to suggest this for an addition to the Go says WAT? 

 collection.

Can someone re-open the bug for further discussion?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/304a1365-9d9e-46f2-92bd-349a60182f5en%40googlegroups.com.