Commit graph

164 commits

Author SHA1 Message Date
Mark Felder
b135fa35a1 RichMedia: test that activity is streamed out 2024-06-24 09:47:16 -04:00
Mark Felder
17d04ccc8b RichMedia backfill processing through Oban 2024-06-19 23:20:22 -04:00
Mark Felder
e628d00a81 Disable Ecto logging in tests
The debug logs are very noisy and can be enabled during analysis of a specific error believed to be SQL-related
2024-06-18 15:25:18 +00:00
Mark Felder
a734efeff8 Formatting 2024-06-12 15:21:43 -04:00
Lain Soykaf
41434ffcec Tests: Don't spawn processes in tests. 2024-06-12 15:20:04 -04:00
Lain Soykaf
f5978da676 HTTPSignaturePlugTest: Rewrite to use mox. 2024-05-28 14:00:25 +04:00
Lain Soykaf
81e44ced0c HTTPSecurityPlug: Fix tests 2024-05-27 22:13:20 +04:00
Lain Soykaf
1c699144d2 HttpSecurityPlug: Don't allow unsafe-eval by default 2024-05-27 21:26:40 +04:00
Lain Soykaf
3055c1598b IPFSTest: Fix configuration mocking 2024-05-27 17:22:18 +04:00
Mark Felder
df0734fcbf Increase the :max_body for Rich Media to 5MB
Websites are increasingly getting more bloated with tricks like inlining content (e.g., CNN.com) which puts pages at or above 5MB. This value may still be too low.
2024-05-07 19:54:56 -04:00
Mark Felder
ede414094f RichMedia refactor
Rich Media parsing was previously handled on-demand with a 2 second HTTP request timeout and retained only in Cachex. Every time a Pleroma instance is restarted it will have to request and parse the data for each status with a URL detected. When fetching a batch of statuses they were processed in parallel to attempt to keep the maximum latency at 2 seconds, but often resulted in a timeline appearing to hang during loading due to a URL that could not be successfully reached. URLs which had images links that expire (Amazon AWS) were parsed and inserted with a TTL to ensure the image link would not break.

Rich Media data is now cached in the database and fetched asynchronously. Cachex is used as a read-through cache. When the data becomes available we stream an update to the clients. If the result is returned quickly the experience is almost seamless. Activities were already processed for their Rich Media data during ingestion to warm the cache, so users should not normally encounter the asynchronous loading of the Rich Media data.

Implementation notes:

- The async worker is a Task with a globally unique process name to prevent duplicate processing of the same URL
- The Task will attempt to fetch the data 3 times with increasing sleep time between attempts
- The HTTP request obeys the default HTTP request timeout value instead of 2 seconds
- URLs that cannot be successfully parsed due to an unexpected error receives a negative cache entry for 15 minutes
- URLs that fail with an expected error will receive a negative cache with no TTL
- Activities that have no detected URLs insert a nil value in the Cachex :scrubber_cache so we do not repeat parsing the object content with Floki every time the activity is rendered
- Expiring image URLs are handled with an Oban job
- There is no automatic cleanup of the Rich Media data in the database, but it is safe to delete at any time
- The post draft/preview feature makes the URL processing synchronous so the rendered post preview will have an accurate rendering

Overall performance of timelines and creating new posts which contain URLs is greatly improved.
2024-05-07 19:54:56 -04:00
Lain Soykaf
923803a533 Tests: Explicitly set db pool size and max cases to the same value. 2024-03-19 10:34:37 +04:00
Mark Felder
eb4dd50f53 Use config to control inclusion of test emoji 2024-01-22 18:37:13 -05:00
Mark Felder
653b14e1c7 Use config to control Uploader callback timeout 2024-01-22 18:37:13 -05:00
Mark Felder
2330100371 Use config to control starting all HTTP pools in test env 2024-01-20 19:10:57 -05:00
Mark Felder
17877f612e Use config to control streamer registry 2024-01-20 18:51:20 -05:00
Mark Felder
4bb57d4f25 Use config to control background migrators 2024-01-20 18:47:25 -05:00
Mark Felder
c7eda0b24a Use config to control loading of custom modules 2024-01-20 18:43:53 -05:00
Mark Felder
029aaf3d74 Use config to control max_restarts 2024-01-20 18:41:04 -05:00
Mark Felder
928bda2e43 Fix invalid string comparison for OTP versions and replace with config
Old way was wrong for multiple reasons. If we do this as a config value it fixes :slave.start/3 being picked up as a compile warning on OTP26.

Also if we want to do any real clustering we'll need something like this to support OTP25 and older.
2023-12-20 23:13:33 +00:00
Mark Felder
cd3abe0b4c Fix more Logger warn -> warning 2023-12-20 16:23:57 -05:00
Lain Soykaf
cca6c20eb6 Revert "EmailTest: use config mock"
This reverts commit dca41cc4a3.
2023-12-12 19:35:19 +04:00
Lain Soykaf
dca41cc4a3 EmailTest: use config mock 2023-12-12 15:25:52 +04:00
Lain Soykaf
190120fd79 Tests: More test fixes 2023-12-12 14:03:46 +04:00
Lain Soykaf
00def0875b RichMediaTest: Use mocked config 2023-12-12 13:28:11 +04:00
Lain Soykaf
22c4d89dbb ScheduledActivity: Use config mocking 2023-12-12 12:48:55 +04:00
Lain Soykaf
90a47ca050 S3 Test: Remove global state dependencies 2023-12-11 09:25:05 +04:00
Lain Soykaf
06fc196772 Backup: Fix config 2023-12-10 19:46:25 +04:00
Lain Soykaf
6e3267d1bd Tests: Fix all the tests. 2023-12-10 19:19:56 +04:00
Lain Soykaf
c068a218ea Backup Tests: Split out async tests, use mox. 2023-12-10 18:57:46 +04:00
Lain Soykaf
e5beab7f16 Config/Test: Don't start promex during testing. 2023-12-10 17:18:18 +04:00
Lain Soykaf
c1402af293 B Getting: Add default implementation, delegate, prepare test support. 2023-11-12 14:49:15 +04:00
Ekaterina Vaartis
398141da68 Merge remote-tracking branch 'upstream/develop' into meilisearch 2022-12-20 21:00:07 +03:00
Lain Soykaf
63d00f8123 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into update-deps 2022-12-15 17:19:36 -05:00
lain
e7c40c2509 fix envvar 2022-11-11 15:40:32 +00:00
Iván Raskovsky
36519bdbee allow custom db port 2022-11-11 12:22:21 -03:00
Mark Felder
7c64f705f6 Update to Phoenix 1.6 and chase dependencies
Also bump minimum Elixir to 1.11
2022-11-03 16:13:07 +00:00
Alexander Strizhakov
4121bca895 expanding WebFinger 2022-11-03 09:48:24 -04:00
Ekaterina Vaartis
a6946048fb Rename Activity.Search to Search.DatabaseSearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
005947e9f7 Add tests for local post indexing for meilisearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
e154ebbf79 Initial meilisearch implementation, doesn't delete posts yet 2022-10-10 20:19:08 +03:00
feld
a833a2d76b Merge branch 'plug-runtime-dev' into 'develop'
Put Plugs in runtime mode in :dev, :test to speed up recompilation

See merge request pleroma/pleroma!3411
2021-05-28 18:57:45 +00:00
Mark Felder
fe40f6f291 Switch from the deprecated "use Mix.config" to "import Config" 2021-05-20 14:02:58 -05:00
Alex Gleason
e3173a279d
Put Plugs in runtime mode in :dev, :test to speed up recompilation 2021-05-19 14:27:46 -05:00
Mark Felder
db7d6f337f Avoid unnecessary 500ms sleeps from CommonAPI.follow when the target user is remote 2021-02-19 18:37:37 -06:00
feld
2926713fe5 Merge branch 'deprecate-public_endpoint' into 'develop'
Deprecate Uploaders.S3, :public_endpoint

See merge request pleroma/pleroma!3251
2021-01-20 22:48:48 +00:00
Mark Felder
5627f3642f Not needed in test.exs 2021-01-13 11:54:45 -06:00
lain
c7cd9bd591 Password: Add password module
Replaces Pbkdf2.
2021-01-13 15:09:01 +01:00
Mark Felder
8b28dce82a Deprecate Pleroma.Uploaders.S3, :public_endpoint 2021-01-12 16:31:35 -06:00
lain
8e5904daa5 SideEffects.DeleteTest: asyncify.
Replace Mock with Mox, mock out Logger.
2021-01-04 18:40:59 +01:00