Skip to content

Bugfix/pn 288 fix sms loop retry#256

Open
marian-craciunescu wants to merge 4 commits into
masterfrom
bugfix/PN-288-fix-sms-loop-retry
Open

Bugfix/pn 288 fix sms loop retry#256
marian-craciunescu wants to merge 4 commits into
masterfrom
bugfix/PN-288-fix-sms-loop-retry

Conversation

@marian-craciunescu
Copy link
Copy Markdown
Collaborator

No description provided.

@marian-craciunescu
Copy link
Copy Markdown
Collaborator Author

@cosminrentea @bogh please take a look ASAP

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 66.488% when pulling 7ea02f0 on bugfix/PN-288-fix-sms-loop-retry into 95aba8d on master.

gateway.route.Deliver(&msg, true)
// wait for retry to complete alongside with the 3 sent sms.
time.Sleep(500 * time.Millisecond)
a.Equal(uint64(4), gateway.LastIDSent, "Last id sent should be the msgID since the retry failed.Already try it for 4 time.Anymore retries would be useless")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice documentation by test-code

Comment thread server/sms/sms_gateway_test.go Outdated
// deliver the message on the gateway route.
gateway.route.Deliver(&msg, true)
// wait for retry to complete alongside with the 3 sent sms.
time.Sleep(500 * time.Millisecond)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 ms and 4 messages => are these values dependent on some constants in the code itself (like 100 ms, 3 retries)?
maybe: you could define&reuse some constants

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

mockMessageStore.EXPECT().MaxMessageID(gomock.Any()).Return(uint64(2), nil)

//setup a new sms gateway
worker := 8
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if other workers (not the one retrying to send) are sending correct messages at the same time?
is the lastMessageID correctly updated ?

Copy link
Copy Markdown
Collaborator Author

@marian-craciunescu marian-craciunescu Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have only one worker at one moment.Only the config value is set but not used afterwards

	if *config.Workers <= 0 {
		*config.Workers = connector.DefaultWorkers
	}

So we can not have the situation you described.
As for workers maybe I should put a comment (something like will be used in future) or just delete it since we do not use it)
As for lastMessageID in the test we have 2 asserts which checks this value.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't know that we have only one worker currently for sms - so how were the other correct sms sent the previous days?

Copy link
Copy Markdown
Collaborator

@cosminrentea cosminrentea Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add

  • a TODO comment like you said
  • a log on INFO showing the real "computed" number of workers for sms

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the loop started I ussually saw that no other sms we're sent.but that was in the past.For this case I do not understand it either.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the LOG it is useless since we do not use config.Workers in any other places except tests.
I will add the TODO

}

// when sms is sent simulate an error.No Sms will be delivered with success for 4 times.
mockSmsSender.EXPECT().Send(gomock.Eq(&msg)).Times(4).Return(ErrIncompleteSMSSent)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, add a proof - maybe from Kibana - that this was the actual error that triggered the loop

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Say what? 😮

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I was saying before the last deploy was done on Friday..so ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.5%) to 66.774% when pulling b4f18db on bugfix/PN-288-fix-sms-loop-retry into 95aba8d on master.

}

// when sms is sent simulate an error.No Sms will be delivered with success for 4 times.
mockSmsSender.EXPECT().Send(gomock.Eq(&msg)).Times(4).Return(ErrIncompleteSMSSent)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// when sms is sent simulate an error.No Sms will be delivered with success for 4 times.
mockSmsSender.EXPECT().Send(gomock.Eq(&msg)).Times(4).Return(ErrIncompleteSMSSent)
Copy link
Copy Markdown
Collaborator

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.3%) to 66.619% when pulling 95ec9af on bugfix/PN-288-fix-sms-loop-retry into 95aba8d on master.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants