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

Feat/cache integration #639

Merged
merged 34 commits into from
Mar 23, 2023
Merged

Feat/cache integration #639

merged 34 commits into from
Mar 23, 2023

Conversation

tobi-bams
Copy link
Contributor

Cache integration added to relay

@tobi-bams tobi-bams linked an issue Mar 14, 2023 that may be closed by this pull request
@Evanfeenstra
Copy link
Contributor

Cool @tobi-bams !

I don't see how the test can work, if you don't add "preview" to the tribe.

Next, we need a separate route to set the "preview" field in a tribe. The main relay config can have a default_cache_host or the route can accept a host as well.

The preview field should just be the host and port of the cache server, so in getCacheMsg you need to add "https://" to the beginning like: https://${preview}/api...

@tobi-bams
Copy link
Contributor Author

Cool @tobi-bams !

I don't see how the test can work, if you don't add "preview" to the tribe.

Next, we need a separate route to set the "preview" field in a tribe. The main relay config can have a default_cache_host or the route can accept a host as well.

The preview field should just be the host and port of the cache server, so in getCacheMsg you need to add "https://" to the beginning like: https://${preview}/api...

@Evanfeenstra, I was able to do some manipulation on my local machine to add the preview to the tribe and the test did pass.

I will also create the route that stores the preview, My concern so far is how do we tend to validate the preview URL to ensure the URL is valid(that is a valid cache server)?

@Evanfeenstra
Copy link
Contributor

@Evanfeenstra, I was able to do some manipulation on my local machine to add the preview to the tribe and the test did pass.

I will also create the route that stores the preview, My concern so far is how do we tend to validate the preview URL to ensure the URL is valid(that is a valid cache server)?

Good point. When you add the preview, you should hit the endpoint to check it works. You can GET /pubkeys from the cache server, which will return the "pubkey" and the "contact_key", which then you can use the add cache server to the tribe as a member. Make sense?

@tobi-bams
Copy link
Contributor Author

@Evanfeenstra, I was able to do some manipulation on my local machine to add the preview to the tribe and the test did pass.
I will also create the route that stores the preview, My concern so far is how do we tend to validate the preview URL to ensure the URL is valid(that is a valid cache server)?

Good point. When you add the preview, you should hit the endpoint to check it works. You can GET /pubkeys from the cache server, which will return the "pubkey" and the "contact_key", which then you can use the add cache server to the tribe as a member. Make sense?

Yes, it makes sense!!!

@Evanfeenstra
Copy link
Contributor

@tobi-bams I removed the DEFAULT_CACHE_HOST for now, i want to make sure it works 100% before merging anything that could make existing tribes miss messages

The last step is to add preview to the tribes server when updating from relay. The route is PUT /tribepreview/{UUID}?preview={PREVIEW}

@tobi-bams
Copy link
Contributor Author

@tobi-bams I removed the DEFAULT_CACHE_HOST for now, i want to make sure it works 100% before merging anything that could make existing tribes miss messages

The last step is to add preview to the tribes server when updating from relay. The route is PUT /tribepreview/{UUID}?preview={PREVIEW}

Alright...

@Evanfeenstra
Copy link
Contributor

Evanfeenstra commented Mar 16, 2023

@tobi-bams

  • tribe owner should always save all the messages

  • also we need to avoid saving messages in other routes like receiveBoost, receiveAttachment

@Evanfeenstra
Copy link
Contributor

Great. Tomorrow can you try all the tribe tests with preview set to make sure nothing breaks

@tobi-bams
Copy link
Contributor Author

@Evanfeenstra fields that are not present in cache object

[
  'created_at',
  'updated_at',
  'receiver',
  'remote_message_content',
  'subscription_id',
  'seen',
  'tenant',
  'person',
  'forwarded_sats',
  'push',
  'only_owner'
]

@Evanfeenstra
Copy link
Contributor

last thing @omoniyi24

add cache field here. https://github.com/stakwork/sphinx-relay/blob/master/src/tests/config.ts

If that is set then the tribe tests run setTribePreview with that value. That way we can flip it on and off later

@Evanfeenstra Evanfeenstra merged commit b87ebad into master Mar 23, 2023
@Evanfeenstra Evanfeenstra deleted the feat/cache-integration branch March 30, 2023 17:09
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.

cache integration
2 participants