Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add env var to disable rehydrate #1367

Merged
merged 3 commits into from
Apr 2, 2021
Merged

Add env var to disable rehydrate #1367

merged 3 commits into from
Apr 2, 2021

Conversation

vicky-g
Copy link
Contributor

@vicky-g vicky-g commented Apr 1, 2021

Description

What is the purpose of this PR? What is the current behavior? New behavior? Relevant links (e.g. Trello) and/or information pertaining to PR?

Disable rehydrate depending on env var value disableRehydrate

Tests

List the manual tests and repro instructions to verify that this PR works as anticipated. Include log analysis if possible.
❗ If this change impacts clients, make sure that you have tested the clients ❗

  1. Added log statement to check if variable works as intended (only for testing):
  async addRehydrateIpfsFromFsIfNecessaryTask (multihash, storagePath, { logContext }, filename = null) {
    if (enableRehydrate) {
      console.log('I AM ADDING A REHYTDRATE TASKKSK')
      this.logStatus(logContext, 'Adding a rehydrateIpfsFromFsIfNecessary task to the queue!')
      const count = await this.queue.count()
      if (count > MAX_COUNT) return
      const job = await this.queue.add(
        PROCESS_NAMES.rehydrate_file,
        { multihash, storagePath, filename, logContext }
      )
      this.logStatus(logContext, 'Successfully added a rehydrateIpfsFromFsIfNecessary task!')

      return job
    }
  }
  1. Hit the /ipfs/:CID route with an existing CID
  2. Checked CN logs
Zc-aaA, requestMethod=GET, requestHostname=localhost)
    requestUrl: /ipfs/QmcUQgQWkUtwtEZWupG6HK1gyhhhN5eNeDa6pFBBaMnXWk
I AM ADDING A REHYTDRATE TASKKSK
[2021-04-02T00:16:23.672Z]  INFO: audius_creator_node/7223 on af34b1ef01a9: Retrieving /file_storage/files/nXW/QmcUQgQWkUtwtEZWupG6HK1gyhhhN5eNeDa6pFBBaMnXWk directly from filesystem (requestID=7fIZc-aaA, requestMethod=GET, requestHostname=localhost)
    requestUrl: /ipfs/QmcUQgQWkUtwtEZWupG6HK1gyhhhN5eNeDa6pFBBaMnXWk
  1. Made sure that I was still able to retrieve the contents of the CID (metadata showed up in URL)

@vicky-g vicky-g added the content-node Content Node (previously known as Creator Node) label Apr 1, 2021
@vicky-g vicky-g requested a review from dmanjunath April 1, 2021 23:12
creator-node/src/config.js Show resolved Hide resolved
creator-node/src/routes/files.js Outdated Show resolved Hide resolved
@vicky-g vicky-g requested a review from SidSethi April 2, 2021 00:20
@vicky-g vicky-g merged commit ee5ba82 into master Apr 2, 2021
@vicky-g vicky-g deleted the vg-rehydrate-env-var branch April 2, 2021 01:26
@dmanjunath
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content-node Content Node (previously known as Creator Node)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants