bootstrapping-microservices-2nd-edition / chapter-5

Code examples for chapter 5 of Bootstrapping Microservices (2nd edition)
MIT License
1 stars 7 forks source link

Record duplication saving videopath on direct messaging #2

Open afce058 opened 3 months ago

afce058 commented 3 months ago

When I replicated the example of direct messaging (section 5.7.5), the record is saved 2 times in mongo, after debugging I found this is caused by the statement: fs.createReadStream(videoPath).pipe(res);

Any solution?

stephenwithav commented 1 month ago

It happens in a Go translation I'm working on, too. I don't think it's a Node-specific issue, but I'll work on solving it next week.

jakedevopsblazer commented 3 days ago

@stephenwithav Hello, could you please tell me if you resolved this issue? I am also working on a go translation of the code. If you are publicly committing the code in your repo, could you please share the link? I just wanted to know which package are you using for the translation. I am new to Golang and using Gin framework for this book.

I also saw that this issue is not happening when I am testing it in Firefox as opposed to Chrome or edge for both NodeJS and Golang. Developer console in Chrome displays 2 request to the same endpoint, one with type document and other with type media whereas Firefox sends one request with type mp4. I am unsure on how to resolve this. Thanks a lot

stephenwithav commented 3 days ago

@jakedevopsblazer I'm using the standard net/http package and never resolved it, so I moved on.

I'm almost done with Chapter 9 and will push all the code here when Chapter 10 is complete. The testing chapter is interesting to replicate with Ginkgo and Gomega.

jakedevopsblazer commented 2 days ago

@stephenwithav Awesome!! Thanks a lot for sharing. I’m excited to see your implementation and learn from it.

stephenwithav commented 2 days ago

@jakedevopsblazer Expect to see something next week. I'm focusing on refining my YC pitch today and tomorrow.