~emersion/soju-dev

server: do not require restart for newly added users v1 REJECTED

Lauri Tirkkonen: 1
 server: do not require restart for newly added users

 1 files changed, 7 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/38222/mbox | git am -3
Learn more about email & git

[PATCH] server: do not require restart for newly added users Export this patch

if the user exists in the database but was not loaded on daemon startup,
attempt to load it from the database before instructing the operator to
restart the daemon.
---
 server.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server.go b/server.go
index 7d1d305..79c19f2 100644
--- a/server.go
+++ b/server.go
@@ -390,6 +390,13 @@ func (s *Server) forEachUser(f func(*user)) {
func (s *Server) getUser(name string) *user {
	s.lock.Lock()
	u := s.users[name]
	if u == nil {
		dbu, err := s.db.GetUser(context.TODO(), name)
		if err == nil {
			s.addUserLocked(dbu)
			u = s.users[name]
		}
	}
	s.lock.Unlock()
	return u
}
-- 
2.37.3

-- 
Lauri Tirkkonen | lotheac @ IRCnet
Thanks for the patch, but this feature has already been rejected in the
past:

https://lists.sr.ht/~emersion/soju-dev/patches/25249
https://lists.sr.ht/~emersion/soju-dev/patches/26042