Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the MMDB writer thread safe? #92

Closed
mandar-01 opened this issue Aug 10, 2024 · 1 comment
Closed

Is the MMDB writer thread safe? #92

mandar-01 opened this issue Aug 10, 2024 · 1 comment

Comments

@mandar-01
Copy link

I am planning to concurrently insert data into MMDB using go routines. Each routine will read data from a source and insert it to the writer object. Once all ingestion is done, I am planning to save the MMDB file. Here is how I have defined the writer:

writer, err := mmdbwriter.New( mmdbwriter.Options{ IncludeReservedNetworks: true, RecordSize: 32, }, )

Can I invoke writer.InsertFunc() from multiple go routines?

@oschwald
Copy link
Member

No, it is not thread safe. You would need to guard it with a mutex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants