guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#62584] [PATCH] services: Add error/success service type.


From: Ludovic Courtès
Subject: [bug#62584] [PATCH] services: Add error/success service type.
Date: Sat, 01 Apr 2023 18:51:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi 宋文武,

宋文武 <iyzsong@envs.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> I think it’s good to have it by default, but that’s something we can
>> discuss.
>
> Okay, I don't think so...

Well, naming and defaults are two hard issues in programming.

>> +(define (error/success-boot-gexp _)
>> +  #~(begin
>> +      (display "error in finalization thread: Success\n"
>> +               (current-error-port))
>> +      (sleep 2)))           ;let the user notice--all this hasn't been in 
>> vain
>
> How about make the message and delay customable?
>
> I prefer "No error in finalization thread: Success",
> and 2 seconds may not be enough for a slow reader like me!

Ah yes, good points!  We could probably have a configuration record like
we do for other services.  That way, one could write, say:

  (service error/success-service-type
           (error/success-configuration
             (errno EINVAL)
             (message-type 'no-error)
             (delay 10)))

I’d prefer to leave that for a subsequent patch though, so we can first
restore the previous situation.

>> +(define error/success-service-type
>> +  (service-type
>> +   (name 'error/success)
>> +   (extensions
>> +    (list (service-extension boot-service-type
>> +                             error/success-boot-gexp)))
>> +   (default-value 42)
>
> What are this 42 is for?

It’s currently unused but increases the chances that it’ll give the
right answer.

Thanks for your feedback!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]