fuzzball-muck/fuzzball

Small Request: "DONE" message after @dump

starafar opened this issue · 5 comments

Currently, @dump will tell me Dumping... but never inform when database save is finished.

Well, it relies on the @dump messages configured in your tune settings. On hope island:

Dumping...
## Please stand by, database save in progress. ##
## Database save is complete. ##

I think hope is using inline dump, so this behavior might be different in the case of a forked dump (i.e. a dump that doesn't pause the MUCK while it is running). So are your dumps working like Hope and your messages are not sufficient so you want an additional "Done"? Or are you using an async dump and not getting these messages?

I was incredibly vague when I originally opened this issue. The messages in @tune get sent to everyone. What I would like is a "dump complete" confirmation to be sent to the invoker of @dump, but no one else.

Gotchya. That is weirdly complicated because, as I recall, once @dump forks, it loses all sense of who made the initial call. That said, we should be able to carry a triggering person ref along for the ride, so I'll see what we can do here.

In researching this, I have learned there's a MUF event called 'DUMP' that is triggered when a dump is complete. I don't know if that is interesting or not. It appears to be the only time something like this is done in the codebase that I can easily tell. Of course, this event won't tell you who triggered the dump.

How dump notifications work is really sketchy. We fork the dump process then collect it later, but when we collect it, we flag that we need to notify rather than do the notify there. I COULD put the "dump complete" notification there, but then it will always show up before the global notification.

I've chosen instead to put the "dump complete" notification in the same code block as the global notification. This is both what would be expected by future developers I think, but also makes sure "dump complete" shows up after the global notification which I think is nicer. However, it technically introduces a race condition where someone could "steal" your dump complete message. I.e. you trigger a dump, then another wizard triggers a dump at the exact millisecond the first completes, then the other wizard could theoretically steal your complete message.

However, I think simplicity and logical layout is more important than solving for a nearly impossible to happen edge case. That said, I think the real right answer is to move the notification into the signal handler, but I don't think it is important enough to do the surgery or even really recommend doing the surgery at this time.

@astarafar This should do it for you, let me know if you have any problems.