Skip to content

Conversation

@yasirfolio3
Copy link
Contributor

@yasirfolio3 yasirfolio3 commented Nov 18, 2019

  1. Added support for caching datafiles using Last-Modified.

@yasirfolio3 yasirfolio3 requested a review from a team as a code owner November 18, 2019 10:49
@yasirfolio3 yasirfolio3 changed the title feat(PollingConfigManager): Implemented caching headers in PollingConfigManager. feat(PollingConfigManager): Implemented caching headers in PollingConfigManager. (WIP) Nov 18, 2019
}

if code == 304 {
cmLogger.Debug("The datafile was not modified and won't be downloaded again")
Copy link
Contributor

Choose a reason for hiding this comment

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

if we want to go this way, I am not sure if the logic :

if projectConfig.GetRevision() == previousRevision {
		cmLogger.Debug(fmt.Sprintf("No datafile updates. Current revision number: %s", cm.projectConfig.GetRevision()))
		closeMutex(nil)
		return
	}

is still needed. It is saying the same thing. I am not even sure if there is a real case scenario for that logic to be executed.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about if anyone is providing URL template (server) which doesn't provide status 304? but keeps the datafile same?

Copy link
Contributor

Choose a reason for hiding this comment

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

are you saying that somebody would try to reimplement requester ? Our default requester is using http libs and I think you will always get Last Modified header. @mikeng13 , what do you think ?

Copy link
Contributor

@msohailhussain msohailhussain Nov 18, 2019

Choose a reason for hiding this comment

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

no am saying, like in FSC we use our datafile server, if anyone using like that for testing their own stuff then it may cause loading same projectconfig everytime.

Copy link
Contributor

@pawels-optimizely pawels-optimizely left a comment

Choose a reason for hiding this comment

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

please look at my comment.

@mikeproeng37 mikeproeng37 changed the title feat(PollingConfigManager): Implemented caching headers in PollingConfigManager. (WIP) feat(PollingConfigManager): Implemented caching headers in PollingConfigManager. Nov 18, 2019
Copy link
Contributor

@pawels-optimizely pawels-optimizely left a comment

Choose a reason for hiding this comment

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

I would still want @mikeng13 to take a look at it.

return
}

if code == 304 {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use http.StatusNotModified instead of 304 ( it will be clearer)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated all previously hardcoded status codes too.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks good, tested the code with datafile changes.

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

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

Code looks fine to me. Are we able to run this against the DFM FSC test cases @yasirfolio3 or @msohailhussain

return
}

if code == 304 {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@msohailhussain
Copy link
Contributor

@mikeng13 no we can't run FSC DFM right now. Steps definition to be added for that and also need to run datafile server (travis related change).

@mikeproeng37 mikeproeng37 merged commit cd323d4 into master Nov 19, 2019
@mikeproeng37 mikeproeng37 deleted the yasir/caching-headers branch November 19, 2019 19:49
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.

5 participants