fix: 7 performance/correctness fixes — v0.1.20
1. Убрано логирование тела сообщения (256KB I/O на каждый send — perf+security) 2. SentTimestamp исправлен: m.SentTime вместо time.Now() (баг) 3. MD5 не пересчитывается на ReceiveMessage — используется кэш из SendMessage 4. ChangeMessageVisibility/batch теперь персистит в Redis (баг — потеря данных) 5. MessageDoesNotExist error code: QueueExists → ReceiptHandleIsInvalid (copy-paste баг) 6. copystructure убран из GetQueueAttributes — простой map lookup 7. SNS dead code удалён (SnsErrors, SnsErrorType — не используется в SQS сервисе) Tested: quick_test 31/31 PASS, deployed v0.1.20
This commit is contained in:
+1
-29
@@ -6,7 +6,7 @@ func init() {
|
||||
SqsErrors = map[string]SqsErrorType{
|
||||
"QueueNotFound": {HttpError: http.StatusBadRequest, Type: "Not Found", Code: "AWS.SimpleQueueService.NonExistentQueue", Message: "The specified queue does not exist for this wsdl version."},
|
||||
"QueueExists": {HttpError: http.StatusBadRequest, Type: "Duplicate", Code: "AWS.SimpleQueueService.QueueExists", Message: "The specified queue already exists."},
|
||||
"MessageDoesNotExist": {HttpError: http.StatusNotFound, Type: "Not Found", Code: "AWS.SimpleQueueService.QueueExists", Message: "The specified queue does not contain the message specified."},
|
||||
"MessageDoesNotExist": {HttpError: http.StatusNotFound, Type: "Not Found", Code: "ReceiptHandleIsInvalid", Message: "The specified receipt handle is not valid."},
|
||||
"GeneralError": {HttpError: http.StatusBadRequest, Type: "GeneralError", Code: "AWS.SimpleQueueService.GeneralError", Message: "General Error."},
|
||||
"TooManyEntriesInBatchRequest": {HttpError: http.StatusBadRequest, Type: "TooManyEntriesInBatchRequest", Code: "AWS.SimpleQueueService.TooManyEntriesInBatchRequest", Message: "Maximum number of entries per request are 10."},
|
||||
"BatchEntryIdsNotDistinct": {HttpError: http.StatusBadRequest, Type: "BatchEntryIdsNotDistinct", Code: "AWS.SimpleQueueService.BatchEntryIdsNotDistinct", Message: "Two or more batch entries in the request have the same Id."},
|
||||
@@ -25,17 +25,6 @@ func init() {
|
||||
// MissingParameter — обязательный параметр отсутствует (например, пустой MessageBody)
|
||||
"MissingParameter": {HttpError: http.StatusBadRequest, Type: "MissingParameter", Code: "MissingParameter", Message: "The request must contain the parameter MessageBody."},
|
||||
}
|
||||
SnsErrors = map[string]SnsErrorType{
|
||||
"InvalidParameterValue": {HttpError: http.StatusBadRequest, Type: "InvalidParameterValue", Code: "AWS.SimpleNotificationService.InvalidParameterValue", Message: "An invalid or out-of-range value was supplied for the input parameter."},
|
||||
"TopicNotFound": {HttpError: http.StatusBadRequest, Type: "Not Found", Code: "AWS.SimpleNotificationService.NonExistentTopic", Message: "The specified topic does not exist for this wsdl version."},
|
||||
"SubscriptionNotFound": {HttpError: http.StatusNotFound, Type: "Not Found", Code: "AWS.SimpleNotificationService.NonExistentSubscription", Message: "The specified subscription does not exist for this wsdl version."},
|
||||
"TopicExists": {HttpError: http.StatusBadRequest, Type: "Duplicate", Code: "AWS.SimpleNotificationService.TopicAlreadyExists", Message: "The specified topic already exists."},
|
||||
"ValidationError": {HttpError: http.StatusBadRequest, Type: "InvalidParameter", Code: "AWS.SimpleNotificationService.ValidationError", Message: "The input fails to satisfy the constraints specified by an AWS service."},
|
||||
"BatchEntryIdsNotDistinct": {HttpError: http.StatusBadRequest, Type: "BatchEntryIdsNotDistinct", Code: "AWS.SimpleNotificationService.BatchEntryIdsNotDistinct", Message: "Two or more batch entries in the request have the same Id."},
|
||||
"EmptyBatchRequest": {HttpError: http.StatusBadRequest, Type: "EmptyBatchRequest", Code: "AWS.SimpleNotificationService.EmptyBatchRequest", Message: "The batch request doesn't contain any entries."},
|
||||
"TooManyEntriesInBatchRequest": {HttpError: http.StatusBadRequest, Type: "TooManyEntriesInBatchRequest", Code: "AWS.SimpleNotificationService.TooManyEntriesInBatchRequest", Message: "Maximum number of entries per request are 10."},
|
||||
"MalformedInput": {HttpError: http.StatusBadRequest, Type: "Sender", Code: "AWS.SimpleNotificationService.MalformedInput", Message: "Invalid Base64 encoding"},
|
||||
}
|
||||
}
|
||||
|
||||
type SqsErrorType struct {
|
||||
@@ -54,20 +43,3 @@ func (s SqsErrorType) Response() ErrorResult {
|
||||
}
|
||||
|
||||
var SqsErrors map[string]SqsErrorType
|
||||
|
||||
type SnsErrorType struct {
|
||||
HttpError int
|
||||
Type string
|
||||
Code string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (s SnsErrorType) StatusCode() int {
|
||||
return s.HttpError
|
||||
}
|
||||
|
||||
func (s SnsErrorType) Response() ErrorResult {
|
||||
return ErrorResult{Type: s.Type, Code: s.Code, Message: s.Message}
|
||||
}
|
||||
|
||||
var SnsErrors map[string]SnsErrorType
|
||||
|
||||
Reference in New Issue
Block a user