使用StackExchange.Redis连接到redis失败后,事务无法正常工作(Transaction not working after unsuccessful connection to redis using StackExchange.Redis)
我不确定,这是一个错误还是我做错了什么。 代码如下:
using StackExchange.Redis; ConnectionMultiplexer conn = null; while (conn == null); { try { conn = ConnectionMultiplexer.Connect("localhost:6379"); } catch (Exception) { conn = null; Thread.Sleep(TimeSpan.FromSeconds(5)); } } var db = conn.GetDatabase(); var transaction = db.CreateTransaction(); var tasks = new List<Task>(); tasks.Add(transaction.HashSetAsync("key", "field", "value")); if (transaction.Execute()) { Task.WaitAll(tasks.ToArray()); }
当我使用启动redis(Windows版本 - 2.6,2.8.17,2.8.19)运行它时,一切正常。 如果我在循环的几个循环之后启动redis,要么它不会跳转到if语句,要么跳转并在WaitAll()上被阻塞。 如果我尝试检查redis中的值,则会存储它们。
当我们启动服务器并忘记启动redis时会发生这种情况。 在推迟redis的开始后,它会被卡住。 使用批处理而不是事务时会出现同样的问题。
我与多路复用器连接错误还是错误? (我发现很少看起来很相似,但我不确定)
I'm not sure, whether it is a bug or I'm doing something wrong. Here is the code:
using StackExchange.Redis; ConnectionMultiplexer conn = null; while (conn == null); { try { conn = ConnectionMultiplexer.Connect("localhost:6379"); } catch (Exception) { conn = null; Thread.Sleep(TimeSpan.FromSeconds(5)); } } var db = conn.GetDatabase(); var transaction = db.CreateTransaction(); var tasks = new List<Task>(); tasks.Add(transaction.HashSetAsync("key", "field", "value")); if (transaction.Execute()) { Task.WaitAll(tasks.ToArray()); }
When I run it with started redis (windows version - 2.6, 2.8.17, 2.8.19), everything works fine. If I start redis after few loops of the cycle, either it doesn't jump into if-statement or it jumps and get blocked on WaitAll(). If I try to check values in redis, they are stored.
This situation happens when we start server and forget to start redis. After postpone start of redis it gets stuck. The same problem appears when using batch instead of transaction.
Am I doing connection to multiplexer wrong or is it bug? (I found few that looked similar but I'm not sure)
原文:https://stackoverflow.com/questions/29851293
满意答案
我会首先尝试一个体积射线施法者。
您可以谷歌“使用光线投射进行体积可视化”,这应该可以为您提供所需的大部分内容。 NVidia通过3D纹理有一个很好的样本(使用openg)射线投射。
根据您的具体实施,您只需要逐步调整累积温度的体积,直到达到所需的密度。
如果您的音量不适合视频内存,您可以分片进行光线投射,然后执行合成步骤。
光线投射的快速描述:
CPU:1)在世界空间中渲染六边形立方体,因为绘图原始确保使用深度剔除。
顶点着色器:2)在顶点着色器中存储顶点的世界位置(这将按每个fragmet进行插值)
片段着色器:3)使用插值位置减去摄像机位置来获得遍历音量的矢量。 4)使用while循环从立方体上的点穿过另一侧的音量。 有3种方法可以知道何时结束。 A)在每个步骤测试该点是否仍在立方体中。 B)与立方体进行光线交叉并计算交叉点之间的距离。 C)使用正面剔除对立方体进行预渲染,并将深度存储到第二个纹理贴图中,然后在屏幕像素处进行采样以获得距离。
5)循环时累积并设置像素颜色。
I would try a volume ray caster first.
You can google "Volume Visualization With Ray Casting" and that should give you most of what you need. NVidia has a great sample (using openg) of ray casting through a 3D texture.
On your specific implementation, you would just need to keep stepping through the volume accumlating the temperature until you reach the wanted density.
If your volume doesn't fit in video memory, you can do the ray casting in pieces and then do a composition step.
A quick description of ray casting:
CPU: 1) Render a six sided cube in world space as the drawing primitive make sure to use depth culling.
Vertex shader: 2) In the vertex shader store off the world position of the vertices (this will interpolate per fragmet)
Fragment shader: 3) Use the interpolated position minus the camera position to get the vector of traversal through the volume. 4) Use a while loop to step through the volume from the point on the cube through the other side. 3 ways to know when to end. A) at each step test if the point is still in the cube. B) do a ray intersection with cube and calculate the distance between the intersections. C) do a prerender of the cube with forward face culling and store the depths into a second texture map then just sampe at the screen pixel to get the distance.
5) accumulate while you loop and set the pixel color.
相关问答
更多volumetric scalar data是什么意思
在OpenGL和GLSL中进行点渲染(point rendering in openGL and GLSL)
如何在OpenGL中渲染叠加的平面对象?(How to render superimposed planar objects in OpenGL?)
如何从Vulkan渲染到OpenGL?(How to render to OpenGL from Vulkan?)
使用openGL渲染场景(Render a scene with openGL)
OpenGL / GLSL:从体积数据中渲染云/烟雾的最佳算法是什么?(OpenGL/GLSL: What is the best algorithm to render clouds/smoke out of volumetric data?)
使用OpenGL和GLSL的SSAO算法的奇怪表现行为(Strange performance behaviour with SSAO algorithm using OpenGL and GLSL)
在OpenGL中绘制两个点云之间的交点(Draw Intersection between two point clouds in OpenGL)
是否有可能破解GTK渲染到OpenGL纹理(Is it possible to hack GTK to render to OpenGL texture)
我想使用openStreetMap数据在openGL中渲染道路,我应该从哪里开始?(I want to use openStreetMap data to render roads in openGL, where should I start?)
相关文章
更多Redis Cookbook
Redis概述
redis 集群环境搭建-redis集群管理
Redis 事务详解
redis sentinel.conf详解-redis集群管理
redis安装-redis集群管理
Redis 客户端连接、密码验证、连接数设置
快速掌握 redis 数据类型
Redis配置文件详解
基于linux下redis安装与配置
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!