Distributed Services with Go: Need a `Close` function to flush buffer before closing store (Page: 29)

When a store is closed, it just closes the files but items in the buffer are not written to file before closing. So we need an additional Close function that flushes the buffer before closing the store.

func (s *store) Close() error {
	err := s.buffer.Flush()
	if err != nil {
		return err
	return s.File.Close()

Yep, thanks! I’ve added this and a test for it, will be in the next beta.

1 Like