News for hackers. Stuff that matters.
Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by brap on Friday March 10, 2023 @12:17PM (#35097535)
I only skimmed through the landing page so maybe I missed it, but the value proposition isn't clear to me.

If you're going to `await` for the contacts import to finish anyway, what's the advantage of separating the import logic from your main API? It's blocked, so might as well be part of the same service, no?

I could see maybe if the API returned right away with a pointer the user can later poll for task progress, but it doesn't seem like this is the case?

Side note: I like this type of web design, is it an in-house job or did you hire someone external?

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by gearnode on Friday March 10, 2023 @12:32PM (#35097819)
> I only skimmed through the landing page so maybe I missed it, but the value proposition isn't clear to me. > If you're going to `await` for the contacts import to finish anyway, what's the advantage of separating the import logic from your main API? It's blocked, so might as well be part of the same service, no? > I could see maybe if the API returned right away with a pointer the user can later poll for task progress, but it doesn't seem like this is the case?

As you suggest, the API returns right away with a pointer the user can later poll to get the function result. Also, using `await` ensures the function is enqueued on our system.

> Side note: I like this type of web design, is it an in-house job or did you hire someone external?

Happy to hear this! We are working with a friend who is a professional designer.

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by brap on Friday March 10, 2023 @12:44PM (#35098027)
I see, makes perfect sense then. I would clarify that in the example (maybe add another snippet for querying the status).

If your friend is open for business, maybe give them a shoutout ;)

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by gearnode on Friday March 10, 2023 @01:01PM (#35098283)
> I see, makes perfect sense then. I would clarify that in the example (maybe add another snippet for querying the status).

It is true that we don't elaborate on this point on our landing page. We will take that into consideration, thanks.

> If your friend is open for business, maybe give them a shoutout ;)

Again, glad you like his work! He's not available at the moment, but we will stay in touch :)

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by bayesian_horse on Saturday March 11, 2023 @08:04AM (#35107967)
That got me stuck too and it wasn't obvious.

I used to use Celery a lot and find Hangfire lacking. To get the same value out of Defer, you'd need to "listen" to those handles.

And listening may actually mean writing another local background job...

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by johtso on Friday March 10, 2023 @12:20PM (#35097579)
Yeah it's not clear how you uniquely reference a task, a super core feature and something that the Temporal documentation for example covers very early on.
Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by gearnode on Friday March 10, 2023 @12:39PM (#35097946)
When enqueuing an execution, you get back a unique ID referencing it. We will make that clearer in our documentation, thanks.
Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by johtso on Friday March 10, 2023 @12:44PM (#35098036)
Often you want to specify your own unique id based on some property of the job, like a transaction reference, or just a unique combination of parameters. This means you can later refer to it without having to store the reference somewhere. Is this possible?
Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by gearnode on Friday March 10, 2023 @12:54PM (#35098184)
We specify our unique ID based on KSUID specifications. In addition, we are soon releasing the tag feature, which will enable you to store your references on your Defer executions to identify them your way.
Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by johtso on Friday March 10, 2023 @01:25PM (#35098685)
Just ideally the dev experience should be `result = await somethingThatMayHaveBeenCalledBefore(id=txnref, params)`

You shouldn't need to first do a check to see if the task already exists using a different api, and then choose whether or not to run a new task.

At least this is my preference.. a-la Durable Objects.

If you don't specify a custom unique id when calling the task it would then be treated as a task that can (and would make sense to be) run multiple times (i.e. not idempotent).

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by gearnode on Friday March 10, 2023 @02:06PM (#35099350)
Completely agree with you on the importance of idempotency. We will release our implementation shortly with a pattern close to the following:

``` const somethingThatMayHaveBeenCalledBefore = idempotent(myFunc, txnref); const result = await somethingThatMayHaveBeenCalledBefore(params); ```

Re:Launch HN: Defer (YC W23) – Zero-infrastructure backgroun... by ntonozzi on Friday March 10, 2023 @04:18PM (#35101223)
Designers sure love gradients+noise. And dang does it look good.