profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/dylan-chong/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

dylan-chong/ex_structable 7

Reduce boilerplate by generating struct new and put functions, and validate your structs when they are created and updated.

dylan-chong/dotfiles 3

My configuration files (only tested on mac, but for the most part should work on all unix systems)

dylan-chong/aenea-grammars 1

Grammars pulled out of aenea as preparation for merging all grammars.

dylan-chong/a-team-engr101-avc 0

Repository for Autonomous Vehicle Challenge - Group: A-Team - for ENGR101 at Victoria University of Wellington

dylan-chong/absinthe-metrics 0

Pluggable metrics for Absinthe based GraphQL backends

dylan-chong/absinthe_plug 0

Plug support for Absinthe, the GraphQL toolkit for Elixir

dylan-chong/aenea 0

Client-server library for using voice macros from Dragon NaturallySpeaking and Dragonfly on remote/non-windows hosts.

dylan-chong/aenea-setup 0

My setup of aenea (see https://github.com/dictation-toolbox/aenea)

dylan-chong/asdf-php 0

PHP plugin for the asdf version manager

pull request commentabsinthe-graphql/absinthe

Support open ended scalars

Thanks so much for this PR @kdawgwilk !

@benwilson512 At Solve, we were looking at using this feature for a long time. I've got an open PR to use this new feature, but I just wanted to double check if this is a feature that will continue to be supported

kdawgwilk

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

push eventdylan-chong/itunes-applescripts

Dylan Chong

commit sha 5ca9d16ab26085ecab13cbdc3291827fa71bf5a0

Move average-plays configurable stuff

view details

push time in 25 days

push eventdylan-chong/itunes-applescripts

Dylan Chong

commit sha da7cec08e2c5e831b597020bc7e17e6f6671b7fb

Move average-plays configurable stuff

view details

push time in 25 days

create barnchsolvedata/plugins-magento2

branch : SOLV-3320/timeout-graphql-requests

created branch time in a month

delete branch solvedata/plugins-magento2

delete branch : SOLV-3319/index-events-created-at

delete time in a month

push eventsolvedata/plugins-magento2

Dylan Chong

commit sha 9d23c445757625855058757e13e0b73be011f01f

SOLV 3319: Index events created at (#83) * SOLV 3319: Index events created at * Fix bug in revert * Add status index

view details

push time in a month

PR merged solvedata/plugins-magento2

SOLV 3319: Index events created at ready_for_review

Before index:

mysql> explain select * from solvedata_event where created_at > '2020-01-01 00:00:00';
+----+-------------+-----------------+------------+------+---------------+------+---------+------+------+----------+-------------+
| id | select_type | table           | partitions | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+-----------------+------------+------+---------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | solvedata_event | NULL       | ALL  | NULL          | NULL | NULL    | NULL |    1 |   100.00 | Using where |
+----+-------------+-----------------+------------+------+---------------+------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)

After creating index:

mysql> explain select * from solvedata_event where created_at > '2020-01-01 00:00:00';
+----+-------------+-----------------+------------+-------+----------------------------+----------------------------+---------+------+------+----------+-----------------------+
| id | select_type | table           | partitions | type  | possible_keys              | key                        | key_len | ref  | rows | filtered | Extra                 |
+----+-------------+-----------------+------------+-------+----------------------------+----------------------------+---------+------+------+----------+-----------------------+
|  1 | SIMPLE      | solvedata_event | NULL       | range | SOLVEDATA_EVENT_CREATED_AT | SOLVEDATA_EVENT_CREATED_AT | 4       | NULL |    1 |   100.00 | Using index condition |
+----+-------------+-----------------+------------+-------+----------------------------+----------------------------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show indexes from solvedata_event;
+-----------------+------------+-----------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table           | Non_unique | Key_name                                | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-----------------+------------+-----------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| solvedata_event |          0 | PRIMARY                                 |            1 | id          | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| solvedata_event |          1 | SOLVEDATA_EVENT_STORE_ID_STORE_STORE_ID |            1 | store_id    | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| solvedata_event |          1 | SOLVEDATA_EVENT_CREATED_AT              |            1 | created_at  | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+-----------------+------------+-----------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

I also didn't put in a revert() function because

Magento does not allow you to revert a particular module data patch.

Not even bin/magento module:uninstall --non-composer solvedata/plugins-magento2 triggers the revert anyway.

Also the migration is idempotent to avoid duplicating the index that already exists in Bobux

+83 -5

4 comments

3 changed files

dylan-chong

pr closed time in a month

PullRequestReviewEvent

Pull request review commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

 public function getEventsToSend(): array             ])             ->where('attempt < ?', $this->config->getMaxAttemptCount())             ->where('scheduled_at < ?', new \Zend_Db_Expr('NOW()'))-            ->order('status ' . Select::SQL_DESC)-            ->order('scheduled_at ' . Select::SQL_ASC)-            ->order('created_at ' . Select::SQL_ASC)-            // Use the auto-incrementing ID as a tiebreaker since the datetime only use second-level precision

removed to simplify query as not needed (order by id is enough)

dylan-chong

comment created time in a month

pull request commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

Added status index as per call

dylan-chong

comment created time in a month

push eventsolvedata/plugins-magento2

Dylan Chong

commit sha 2c8249ac2f6abfeeb91c22fccbd87d61bc2eaa41

Add status index

view details

push time in a month

pull request commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

Try SolveData_Events. I believe that's the actual name of the module.

Nah nothing happens still

Do you reckon we should also add an index for querying the next batch of events to send?

great idea actually. i'll add index for scheduled_at too

dylan-chong

comment created time in a month

Pull request review commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

+<?php++namespace SolveData\Events\Setup\Patch\Schema;++use Magento\Framework\Setup\ModuleDataSetupInterface;+use Magento\Framework\Setup\Patch\SchemaPatchInterface;+use SolveData\Events\Model\ResourceModel\Event as ResourceModel;+use Magento\Framework\DB\Adapter\AdapterInterface;++class AddCreatedAtIndexToSolvedataEvents implements SchemaPatchInterface+{+    /**+     * @var ModuleDataSetupInterface+     */+    protected $moduleDataSetup;++    /**+     * @param ModuleDataSetupInterface $moduleDataSetup+     */+    public function __construct(+        ModuleDataSetupInterface $moduleDataSetup+    ) {+        $this->moduleDataSetup = $moduleDataSetup;+    }++    /**+     * {@inheritdoc}+     */+    public function apply()+    {+        $connection = $this->moduleDataSetup->getConnection();+        $connection->startSetup();+        $tableName = $connection->getTableName(ResourceModel::TABLE_NAME);++        if (!$this->indexAlreadyExists($connection->getIndexList($tableName))) {+            $connection->addIndex(+                $tableName,+                $connection->getIndexName(+                    ResourceModel::TABLE_NAME,+                    ['created_at'],+                    AdapterInterface::INDEX_TYPE_INDEX+                ),+                ['created_at'],+                AdapterInterface::INDEX_TYPE_INDEX+            );+            // TODO do the other migrations even work?+        }++        $connection->endSetup();+    }++    private function indexAlreadyExists($indexes): bool {+        foreach ($indexes as $indexName => $indexData) {+            if ($indexData['COLUMNS_LIST'] == ['created_at']) {+                return true;+            }+        }+        return false;+    }++    /**+     * {@inheritdoc}+     */+    public static function getDependencies()+    {+        return [];

other migrations don't do it also

dylan-chong

comment created time in a month

PullRequestReviewEvent

Pull request review commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

+<?php++namespace SolveData\Events\Setup\Patch\Schema;++use Magento\Framework\Setup\ModuleDataSetupInterface;+use Magento\Framework\Setup\Patch\SchemaPatchInterface;+use SolveData\Events\Model\ResourceModel\Event as ResourceModel;+use Magento\Framework\DB\Adapter\AdapterInterface;++class AddCreatedAtIndexToSolvedataEvents implements SchemaPatchInterface+{+    /**+     * @var ModuleDataSetupInterface+     */+    protected $moduleDataSetup;++    /**+     * @param ModuleDataSetupInterface $moduleDataSetup+     */+    public function __construct(+        ModuleDataSetupInterface $moduleDataSetup+    ) {+        $this->moduleDataSetup = $moduleDataSetup;+    }++    /**+     * {@inheritdoc}+     */+    public function apply()+    {+        $connection = $this->moduleDataSetup->getConnection();+        $connection->startSetup();+        $tableName = $connection->getTableName(ResourceModel::TABLE_NAME);++        if (!$this->indexAlreadyExists($connection->getIndexList($tableName))) {+            $connection->addIndex(+                $tableName,+                $connection->getIndexName(+                    ResourceModel::TABLE_NAME,+                    ['created_at'],+                    AdapterInterface::INDEX_TYPE_INDEX+                ),+                ['created_at'],+                AdapterInterface::INDEX_TYPE_INDEX+            );+            // TODO do the other migrations even work?+        }++        $connection->endSetup();+    }++    private function indexAlreadyExists($indexes): bool {+        foreach ($indexes as $indexName => $indexData) {+            if ($indexData['COLUMNS_LIST'] == ['created_at']) {+                return true;+            }+        }+        return false;+    }++    /**+     * {@inheritdoc}+     */+    public static function getDependencies()+    {+        return [];

the script that defines the table and column is an installschema patch. this is an update schema patch, so should be fine as the updates run after the installs

dylan-chong

comment created time in a month

PullRequestReviewEvent

pull request commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

bin/magento module:uninstall --non-composer solvedata/plugins-magento2 --remove-data?

nothing happens. it returns 0 even if the module name is wrong...

dylan-chong

comment created time in a month

Pull request review commentsolvedata/plugins-magento2

SOLV 3319: Index events created at

+<?php++namespace SolveData\Events\Setup\Patch\Schema;++use Magento\Framework\Setup\ModuleDataSetupInterface;+use Magento\Framework\Setup\Patch\SchemaPatchInterface;+use SolveData\Events\Model\ResourceModel\Event as ResourceModel;+use Magento\Framework\DB\Adapter\AdapterInterface;++class AddCreatedAtIndexToSolvedataEvents implements SchemaPatchInterface+{+    /**+     * @var ModuleDataSetupInterface+     */+    protected $moduleDataSetup;++    /**+     * @param ModuleDataSetupInterface $moduleDataSetup+     */+    public function __construct(+        ModuleDataSetupInterface $moduleDataSetup+    ) {+        $this->moduleDataSetup = $moduleDataSetup;+    }++    /**+     * {@inheritdoc}+     */+    public function apply()+    {+        $connection = $this->moduleDataSetup->getConnection();+        $connection->startSetup();+        $tableName = $connection->getTableName(ResourceModel::TABLE_NAME);++        if (!$this->indexAlreadyExists($connection->getIndexList($tableName))) {+            $connection->addIndex(+                $tableName,+                $connection->getIndexName(+                    ResourceModel::TABLE_NAME,+                    ['created_at'],+                    AdapterInterface::INDEX_TYPE_INDEX+                ),+                ['created_at'],+                AdapterInterface::INDEX_TYPE_INDEX+            );+        }++        $connection->endSetup();+    }++    private function indexAlreadyExists($indexes): bool {+        foreach ($indexes as $indexName => $indexData) {+            if ($indexData['COLUMNS_LIST'] == ['created_at']) {

yup

Uploading Screenshot 2021-08-23 at 2.23.00 PM.png…

dylan-chong

comment created time in a month

PullRequestReviewEvent

push eventsolvedata/plugins-magento2

Dylan Chong

commit sha c98dfec07b4f5bfb273715550bf16007571ef301

Fix bug in revert

view details

push time in a month

create barnchsolvedata/plugins-magento2

branch : SOLV-3319/index-events-created-at

created branch time in a month

push eventsolvedata/plugins-magento2

Dylan Chong

commit sha ff080e6051c096180d72197d9b989b3153daa0cb

Tidy: Remove unused mass request function and unused callees of it

view details

push time in a month

PullRequestReviewEvent