jmalloc / ax

A message-driven application toolkit for Go. [EXPERIMENTAL]
MIT License
9 stars 3 forks source link

Truncate msg descr before the DB insert. #164

Closed danilvpetrov closed 3 years ago

danilvpetrov commented 3 years ago

This PR truncates the ax message description before the insert to ax_messagestore_message table. This is required to fit into the size of ax_messagestore_message.description field.

danilvpetrov commented 3 years ago

Have you tried this branch, and if so does it fix the problem?

Ok, I tried it now. I had to introduce a message description length check to avoid out-of-bound panic when the description is less than 255 char. Apart from that it works as expected.

I am not sure if there are other places where descriptions are persisted or not.

Looks like description field is also used in ax_saga_snapshot table and ax_saga_instance table. It's probably worth placing truncation on these fields as well.

danilvpetrov commented 3 years ago

I've added message description truncation for ax_saga_snapshot table and ax_saga_instance table in https://github.com/jmalloc/ax/pull/164/commits/5b9da8f110a7fc0200e990fd41000f4073298247.

However, the one of the tests is currently failing due to the difference of in-memory presentation of PB messages. This happens due to the newer version of protoc-gen-go plugin. In addition, the version of the Makefile in this repository is older to what we normally use and does not observe the protobuf package version in go.mod file.

jmalloc commented 3 years ago

Thanks man. Looks like I've got a few things to update there. If you don't mind just use this branch for now until I get a chance to do those protobuf/makefile/test updates, unless you feel like tackling them.

danilvpetrov commented 3 years ago

Rebased from master. The coverage is failing as this PR is adding some more uncovered code.