Code Monkey home page Code Monkey logo

Comments (1)

drraccoony avatar drraccoony commented on June 7, 2024

We identified and resolved the problem. Searching through closed issued, we found #2242.

We used this example and adjusted it to our needs,

require_relative '../lib/postal/config'
WEB_CONCURRENCY = 32
workers         32      # enables cluster mode
threads_count   = 128   # 1 worker per 128 threads
threads         threads_count, threads_count
bind_address    = Postal.config.web_server&.bind_address || '127.0.0.1'
bind_port       = Postal.config.web_server&.port&.to_i || ENV['PORT'] || 5000
bind            "tcp://#{bind_address}:#{bind_port}"
environment     Postal.config.rails&.environment || 'development'
prune_bundler
quiet           false
preload_app!

Though, we may change it to this to allow for Postal.config changes on the fly if needed:

require_relative '../lib/postal/config'

# Default values
default_web_concurrency = 32
default_threads_count = 128

# Use Postal.config values or defaults
WEB_CONCURRENCY = Postal.config.web_server&.web_concurrency || default_web_concurrency
workers         WEB_CONCURRENCY
threads_count   = Postal.config.web_server&.threads_count || default_threads_count
threads         threads_count, threads_count
bind_address    = Postal.config.web_server&.bind_address || '127.0.0.1'
bind_port       = Postal.config.web_server&.port&.to_i || ENV['PORT'] || 5000
bind            "tcp://#{bind_address}:#{bind_port}"
environment     Postal.config.rails&.environment || 'development'
prune_bundler
quiet           false
preload_app!

Reading more up on it, it appears It's redundant to set both WEB_CONCURRENCY and workers to the same value. Generally, WEB_CONCURRENCY is commonly used.

from postal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.