Socket
Book a DemoInstallSign in
Socket

mysql-pause

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql-pause

0.1.8
bundlerRubygems
Version published
Maintainers
1
Created
Source

= mysql-pause

== Description

mysql-pause is a proxy server to pause a query to MySQL.

== Source Code

https://bitbucket.org/winebarrel/mysql-pause

== Dependency

  • EventMachine
  • RExec

== Install

gem install mysql-pause

== Example === Start server

shell> mysql-pause start Starting daemon... Waiting for daemon to start... Daemon status: running pid=56921

shell> mysql -h 127.0.0.1 -P 13306 -u scott -ptiger mysql> select 1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec)

=== Pause

shell> mpctl pause

mysql> select 1; (...no response...)

=== Resume

shell> mpctl resume

(...resume response...) +---+ | 1 | +---+ | 1 | +---+ 1 row in set (18.01 sec)

== Extend MySQL adapter === Install

gem install mysql-pause-adapter-ext

=== Example code

require 'active_record' require 'mysql-pause/adapter-ext'

ActiveRecord::Base.establish_connection( :adapter => 'mysql2', :host => '127.0.0.1', :port => 13306, :username => 'scott', :password => 'tiger', :database => 'employees', :reconnect => true, )

class Employee < ActiveRecord::Base; end

loop do employee = Employee.new employee.first_name = 'Taro' employee.last_name = 'Yamada' employee.save! sleep 3 end

=== Behavior

log> DEBUG -- : (0.6ms) BEGIN log> DEBUG -- : SQL (0.7ms) INSERT INTO employees (first_name, last_name) VALUES ('Taro', 'Yamada') log> DEBUG -- : (0.8ms) COMMIT log> DEBUG -- : (0.6ms) BEGIN

shell> mpctl pause shell> service mysql restart shell> mpctl resume

log> DEBUG -- : (0.6ms) BEGIN (...handle error and reconnect...) log> DEBUG -- : Mysql2::Error: %MYSQL_PAUSE%;;1000;;Aborted backend connection: BEGIN log> WARN -- : ActiveRecord::StatementInvalid: Mysql2::Error: %MYSQL_PAUSE%;;1000;;Aborted backend connection: BEGIN log> DEBUG -- : (0.3ms) BEGIN log> DEBUG -- : SQL (2.1ms) INSERT INTO employees (first_name, last_name) VALUES ('Taro', 'Yamada') log> DEBUG -- : (0.8ms) COMMIT

FAQs

Package last updated on 09 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.