ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - Frost/resin: Make your plug pipeline act more enterprisey...
Make your plug pipeline act more enterprisey... Contribute to Frost/resin development by creating an account on GitHub.
Visit Site

GitHub - Frost/resin: Make your plug pipeline act more enterprisey...

GitHub - Frost/resin: Make your plug pipeline act more enterprisey...

Resin

A very viscous liquid, will make your Plug-based application sluggish.

Resin is a plug that will add a configurable delay to every request that's passing through it, unless run in production.

This is basically a completely useless plug, unless your PM/boss/whoever insists that your project is too snappy and wants a more "realistic" demo...

Usage

Given the example in SimpleApp:

defmodule SimpleApp do
  use Plug.Router

  use Resin, enterpriseyness: 1_000

  plug :match
  plug :dispatch

  get "/hello" do
    conn
    |> send_resp(200,  "That sure was slo^H^H^Henterprisey, right?\n")
  end

  match _ do
    conn
    |> send_resp(404, "nope")
  end

  def start do
    Plug.Adapters.Cowboy.http SimpleApp, [], port: 4000
  end

  def stop do
    Plug.Adapters.Cowboy.shutdown SimpleApp.HTTP
  end
end

Then just run SimpleApp.start in your iex and start cURLing localhost:4000/hello and feel the enterpriseyness:

$ time curl localhost:4000
nope
curl localhost:4000  0.01s user 0.01s system 1% cpu 1.057 total

Are your project managers complaining that your Elixir web application is unrealistically fast, and that your demos does not reflect actual production performance?

Just pour some resin into its Plug.Router and it will be noticably slower more enterprisey!

use Resin

Did your management start believing you are faking this delay because all requests take exactly the same amount of time to complete?

Use a range for the enterpriseyness option, to make the enterpriseyness level differ between requests, making the "performance forecast" (thanks for that term, @DevL).

use Resin, enterpriseyness: 1_000 .. 3_000

This will make add a random number between 1000 and 3000 milliseconds of enterpriseyness.

Are you looking for a way to have delays in a specific pattern, like having every 4th request take an extra second?

Set your enterpriseyness to an array:

use Resin, enterpriseyness: [0, 0, 0, 1_000]

It even works with an array of ranges:

use Resin, enterpriseyness: [100 .. 200, 300 .. 400, 0 .. 1_000]

...or combinations:

use Resin, enterpriseyness: [0, 0, 100, 100 .. 200]

Worried that you will forget to clear out the resin before you ship to production?

No worries! Resin will detect that it's running in a production environment, and just edit itself right out of your AST.

Are you serious?

Not really.

But why?

I was bored and I wanted to build a plug.

Why the name?

Resin is a very viscous liquid.

Also, tar would just be confusing, and acts_as_enterprisey is already an existing thing for Rails, but it would also be too obvious.

Isn't this just acts_as_enterprisey as a plug?

Yes. Cred goes out to @airblade for inspiration.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory