Skip to content

Commit

Permalink
server: convert Start/Stop methods to use sync.Once
Browse files Browse the repository at this point in the history
In this commit, we convert the server's Start/Stop methods to use the
sync.Once. We do this in order to fix concurrency issues that would
allow certain queries to be sent to the server before it has actually
fully start up. Before this commit, we would set started to 1 at the
very top of the method, allowing certain queries to pass before the rest
of the daemon was had started up.

In order to fix this issue, we've converted the server to using a
sync.Once, and two new atomic variables for clients to query to see if
the server has fully started up, or is in the process of stopping.
  • Loading branch information
Roasbeef committed Mar 29, 2019
1 parent 1f187c0 commit 26c5289
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 165 deletions.
3 changes: 2 additions & 1 deletion chanrestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
channelShells = append(channelShells, chanShell)
}

ltndLog.Infof("Inserting %v SCB channel shells into DB")
ltndLog.Infof("Inserting %v SCB channel shells into DB",
len(channelShells))

// Now that we have all the backups mapped into a series of Singles,
// we'll insert them all into the database.
Expand Down
Loading

0 comments on commit 26c5289

Please sign in to comment.